这是indexloc提供的服务,不要输入任何密码

set_state_async 1.1.0 copy "set_state_async: ^1.1.0" to clipboard
set_state_async: ^1.1.0 copied to clipboard

A mixin to avoid "setState while widget is building or locked" issue and improve performance.

About #

SetStateAsync is a mixin that defers multiple setState calls into one within the same event loop.

This approach helps reduce overhead when calling setState multiple times in quick succession, preventing "setState while widget is building or locked" issue and improving performance.

Installation #

  1. Run the following command in your project directory:
flutter pub add set_state_async
  1. Add the following code to your dart file:
import 'package:set_state_async/set_state_async.dart';
  1. Add SetStateAsync mixin to your State class:
class _MyWidgetState extends State<MyWidget> with SetStateAsync {
	// ...
}

Usage #

Just call setStateAsync instead of setState. An optional callback can be passed if you need to perform changes just before rebuilding the widget.

For more information, please check example or API reference.

0
likes
160
points
248
downloads

Publisher

unverified uploader

Weekly Downloads

A mixin to avoid "setState while widget is building or locked" issue and improve performance.

Repository (GitHub)
View/report issues

Topics

#set-state #async #workaround #tweak #performance

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on set_state_async