Skip to content

Commit f15f69a

Browse files
authored
Drops detached message until we can handle it properly (flutter#45430)
1 parent 54aa53a commit f15f69a

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

packages/flutter/lib/src/scheduler/binding.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,11 @@ mixin SchedulerBinding on BindingBase, ServicesBinding {
338338
}
339339

340340
Future<String> _handleLifecycleMessage(String message) async {
341+
// TODO(chunhtai): remove the workaround once the issue is fixed
342+
// https://github.com/flutter/flutter/issues/39832
343+
if (message == 'AppLifecycleState.detached')
344+
return null;
345+
341346
handleAppLifecycleStateChanged(_parseAppLifecycleMessage(message));
342347
return null;
343348
}

packages/flutter/test/widgets/binding_test.dart

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,14 @@ void main() {
6767
message = const StringCodec().encodeMessage('AppLifecycleState.inactive');
6868
await defaultBinaryMessenger.handlePlatformMessage('flutter/lifecycle', message, (_) { });
6969
expect(observer.lifecycleState, AppLifecycleState.inactive);
70+
71+
72+
message = const StringCodec().encodeMessage('AppLifecycleState.detached');
73+
await defaultBinaryMessenger.handlePlatformMessage('flutter/lifecycle', message, (_) { });
74+
// TODO(chunhtai): this should be detached once the issue is fixed
75+
// https://github.com/flutter/flutter/issues/39832
76+
// The binding drops detached message for now.
77+
expect(observer.lifecycleState, AppLifecycleState.inactive);
7078
});
7179

7280
testWidgets('didPushRoute callback', (WidgetTester tester) async {

0 commit comments

Comments
 (0)