This reverts commit 92ef2b9ce1.
This requires either runApp() or
WidgetsFlutterBinding.ensureInitialized() to have been called before
using any MethodChannels. Plugins broadly rely on MethodChannels and
right now there's no general requirements that they be constructed
within the runApp call, so the ecosystem breakages from this are broader
than originally thought. Reverting for now.
This commit is contained in:
committed by
GitHub
parent
77e15103da
commit
821602aef3
@@ -11,6 +11,6 @@ void main() {
|
||||
Ticker((Duration duration) { })..start();
|
||||
|
||||
final ByteData message = const StringCodec().encodeMessage('AppLifecycleState.paused');
|
||||
await ServicesBinding.instance.defaultBinaryMessenger.handlePlatformMessage('flutter/lifecycle', message, (_) {});
|
||||
await defaultBinaryMessenger.handlePlatformMessage('flutter/lifecycle', message, (_) {});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -36,9 +36,9 @@ Future<String> respondToHostRequestForSplashLog(String _) {
|
||||
|
||||
void createTestChannelBetweenAndroidAndFlutter() {
|
||||
// Channel used for Android to send Flutter changes to the splash display.
|
||||
const BasicMessageChannel<String> testChannel = BasicMessageChannel<String>(
|
||||
final BasicMessageChannel<String> testChannel = BasicMessageChannel<String>(
|
||||
'testChannel',
|
||||
StringCodec()
|
||||
const StringCodec()
|
||||
);
|
||||
|
||||
// Every splash display change message that we receive from Android is either
|
||||
|
||||
@@ -25,8 +25,6 @@ const BasicMessageChannel<String> _kReloadChannel =
|
||||
BasicMessageChannel<String>(_kReloadChannelName, StringCodec());
|
||||
|
||||
void main() {
|
||||
// Ensures bindings are initialized before doing anything.
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
// Start listening immediately for messages from the iOS side. ObjC calls
|
||||
// will be made to let us know when we should be changing the app state.
|
||||
_kReloadChannel.setMessageHandler(run);
|
||||
|
||||
Reference in New Issue
Block a user