setState method

  1. @override
void setState(
  1. VoidCallback fn
)
override

Combine all setState calls within the same tick into single one. This also makes the setState opearation async.

Implementation

@override
void setState(VoidCallback fn) {
  if (_fns.isEmpty) {
    Future.microtask(() {
      if (mounted) {
        super.setState(_runFns);
      }
    });
  }
  _fns.add(fn);
}