Skip to main content

after_first_frame_mixin 1.0.0 copy "after_first_frame_mixin: ^1.0.0" to clipboard
after_first_frame_mixin: ^1.0.0 copied to clipboard

Run code after the first layout of a widget has been performed, i.e. after the first frame has been displayed - as a mixin or as a widget.

1.0.0 #

Added #

  • AfterFirstFrame widget - the widget form of the mixin, for subtrees that would otherwise have no reason to be stateful.
  • afterNextFrame(callback) on the mixin - the counterpart of afterFirstFrame for later frames, callable at any point in the widget's life, e.g. to measure a layout a setState has just changed.
  • hasRenderedFirstFrame - whether the first frame has been displayed.
  • AfterFrameCallback typedef for the callback signature.

Fixed #

  • Errors thrown by an asynchronous afterFirstFrame are reported through FlutterError.reportError. The returned Future used to be dropped, so its error escaped as an unhandled asynchronous error, without widget diagnostics and out of reach of FlutterError.onError and tester.takeException().

Other #

  • Requires Dart 3.8 / Flutter 3.32; flutter_lints 6.
  • First test suite: 13 tests covering both APIs, the mounted guard and error reporting. The package previously shipped an empty test.
  • IDE files (.idea/, *.iml) are no longer committed nor published.
  • README rewritten: installation, both APIs, an API table and the scheduling caveats.

0.0.2 #

  • Minor changes.

0.0.1 #

  • Initial release.
1
likes
160
points
228
downloads

Documentation

API reference

Publisher

verified publisherbomsamdi.com

Weekly Downloads

Run code after the first layout of a widget has been performed, i.e. after the first frame has been displayed - as a mixin or as a widget.

Repository (GitHub)
View/report issues

Topics

#widget #lifecycle #mixin #scheduler

License

MIT (license)

Dependencies

flutter

More

Packages that depend on after_first_frame_mixin