[Breaking Change] iOS: FlutterEngine, FlutterViewController no longer FlutterBinaryMessengers

1055 views
Skip to first unread message

Aaron Clarke

unread,
Jun 21, 2019, 5:32:05 PM6/21/19
to flutter-...@googlegroups.com

Code effected

iOS code that sets up channels manually (not plugins).


PR

https://github.com/flutter/engine/pull/9419


Old architecture


New architecture


Justification

The old architecture could lead to inadvertent retain cycles.  For example:

FlutterEngine *-- FlutterPlugin *-- FlutterMethodChannel *-- FlutterEngine


This is of particular interest to the add-to-app flow.


Relevant Issue:

https://github.com/flutter/flutter/issues/26007


Migration

Old Code:

[FlutterMethodChannel 

    methodChannelWithName:@"foo" 

    binaryMessenger:flutterViewController]


New Code:

[FlutterMethodChannel 

    methodChannelWithName:@"foo"

    binaryMessenger:flutterViewController.binaryMessenger]


Plugins:

Plugins usually get the binary messenger from the FlutterPluginRegistrar (ex. [registrar messenger]), so they shouldn't be affected.


In Closing

This proposal should be an easy migration that shouldn't affect many people.  Let me know if this would be a problem for you.

Reply all
Reply to author
Forward
0 new messages