mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Add a `-[FlutterViewController setFlutterViewDidRenderCallback:]` method on iOS so client applications can be notified when the Flutter view has rendered. This can be used for add2app cases to determine when to take an initial screenshot for comparisons in automated tests. The callback is expected to be an Objective-C block (or Swift closure). I chose to support only a single callback because it's much simpler (especially since it does not require a separate method to unregister the callback), and it's not clear that there are use cases that would justify additional complexity. Clients have the flexibility to make their callback invoke other callbacks anyway. I alternatively considered adding a `-[FlutterViewController viewDidRenderFirstFlutterFrame]` method that clients could override in a subclass, but using an Objective-C block seems more flexible and less of a burden. Fixes https://github.com/flutter/flutter/issues/20665