When running a Flutter app in mojo shell, I always get a red screen at the beginning because of the following exception:
Exception caught while building Title("MyTitle")
The null object does not have a getter 'ptr'.
NoSuchMethodError: method not found: 'ptr'
Receiver: null
Arguments: []
Stack trace:
#0 Object._noSuchMethod (dart:core-patch/object_patch.dart:42)
#1 Object.noSuchMethod (dart:core-patch/object_patch.dart:45)
#2 ApplicationConnection.requestService (packages/mojo/src/application_connection.dart:89)
#3 _Shell._connectToService (packages/flutter/src/services/shell.dart:59)
#4 _Shell.connectToService (packages/flutter/src/services/shell.dart:74)
#5 _initActivityProxy (packages/flutter/src/services/activity.dart:25)
#6 _activityProxy (packages/flutter/src/services/activity.dart:29)
#7 _activityProxy (packages/flutter/src/services/activity.dart:29)
#8 updateTaskDescription (packages/flutter/src/services/activity.dart:65)
#9 Title.build (packages/flutter/src/material/title.dart:17)
#10 ComponentElement.performRebuild (packages/flutter/src/widgets/framework.dart:1050)
#11 BuildableElement.rebuild (packages/flutter/src/widgets/framework.dart:991)
#12 ComponentElement._firstBuild (packages/flutter/src/widgets/framework.dart:1037)
#13 ComponentElement.mount (packages/flutter/src/widgets/framework.dart:1032)
#14 Element._inflateWidget (packages/flutter/src/widgets/framework.dart:765)
#15 Element.updateChild (packages/flutter/src/widgets/framework.dart:644)
#16 ComponentElement.performRebuild (packages/flutter/src/widgets/framework.dart:1062)
#17 BuildableElement.rebuild (packages/flutter/src/widgets/framework.dart:991)
#18 ComponentElement._firstBuild (packages/flutter/src/widgets/framework.dart:1037)
#19 ComponentElement.mount (packages/flutter/src/widgets/framework.dart:1032)
#20 Element._inflateWidget (packages/flutter/src/widgets/framework.dart:765)
#21 Element.updateChild (packages/flutter/src/widgets/framework.dart:644)
#22 ComponentElement.performRebuild (packages/flutter/src/widgets/framework.dart:1062)
#23 BuildableElement.rebuild (packages/flutter/src/widgets/framework.dart:991)
#24 ComponentElement._firstBuild (packages/flutter/src/widgets/framework.dart:1037)
#25 ComponentElement.mount (packages/flutter/src/widgets/framework.dart:1032)
#26 Element._inflateWidget (packages/flutter/src/widgets/framework.dart:765)
#27 Element.updateChild (packages/flutter/src/widgets/framework.dart:644)
#28 ComponentElement.performRebuild (packages/flutter/src/widgets/framework.dart:1062)
#29 BuildableElement.rebuild (packages/flutter/src/widgets/framework.dart:991)
#30 ComponentElement._firstBuild (packages/flutter/src/widgets/framework.dart:1037)
#31 ComponentElement.mount (packages/flutter/src/widgets/framework.dart:1032)
#32 Element._inflateWidget (packages/flutter/src/widgets/framework.dart:765)
#33 Element.updateChild (packages/flutter/src/widgets/framework.dart:644)
#34 ComponentElement.performRebuild (packages/flutter/src/widgets/framework.dart:1062)
#35 BuildableElement.rebuild (packages/flutter/src/widgets/framework.dart:991)
#36 ComponentElement._firstBuild (packages/flutter/src/widgets/framework.dart:1037)
#37 ComponentElement.mount (packages/flutter/src/widgets/framework.dart:1032)
#38 Element._inflateWidget (packages/flutter/src/widgets/framework.dart:765)
#39 Element.updateChild (packages/flutter/src/widgets/framework.dart:644)
#40 ComponentElement.performRebuild (packages/flutter/src/widgets/framework.dart:1062)
#41 BuildableElement.rebuild (packages/flutter/src/widgets/framework.dart:991)
#42 ComponentElement._firstBuild (packages/flutter/src/widgets/framework.dart:1037)
#43 StatefulComponentElement._firstBuild (packages/flutter/src/widgets/framework.dart:1131)
#44 ComponentElement.mount (packages/flutter/src/widgets/framework.dart:1032)
#45 Element._inflateWidget (packages/flutter/src/widgets/framework.dart:765)
#46 Element.updateChild (packages/flutter/src/widgets/framework.dart:644)
#47 RenderObjectToWidgetElement.mount (packages/flutter/src/widgets/binding.dart:149)
#48 RenderObjectToWidgetAdapter.attachToRenderTree.<anonymous closure> (packages/flutter/src/widgets/binding.dart:117)
#49 BuildableElement.lockState (packages/flutter/src/widgets/framework.dart:924)
#50 RenderObjectToWidgetAdapter.attachToRenderTree (packages/flutter/src/widgets/binding.dart:114)
#51 WidgetFlutterBinding._runApp (packages/flutter/src/widgets/binding.dart:76)
#52 runApp (packages/flutter/src/widgets/binding.dart:83)
#53 main (lib/main.dart:25)
but rotating the device to rebuild the app fixes the issue.
This can be reproduced simply by this main code
import 'package:flutter/material.dart';
void main() {
runApp(new MaterialApp(
title: 'MyTitle',
routes: {'/': (RouteArguments args) => new Container()}));
}
Looks like runApp is trying to talk to Android for setting up the toolbar too early, but on the second rebuild after rotating the phone things are setup and it succeeds.
This started happening about a week ago, it was fine before that.
@abarth @jamesr
CC @mishadynin
When running a Flutter app in mojo shell, I always get a red screen at the beginning because of the following exception:
but rotating the device to rebuild the app fixes the issue.
This can be reproduced simply by this main code
Looks like
runAppis trying to talk to Android for setting up the toolbar too early, but on the second rebuild after rotating the phone things are setup and it succeeds.This started happening about a week ago, it was fine before that.
@abarth @jamesr
CC @mishadynin