flutter / flutter

Flutter makes it easy and fast to build beautiful apps for mobile and beyond
https://flutter.dev
BSD 3-Clause "New" or "Revised" License
165.09k stars 27.21k forks source link

Better error message when displaying a FlutterEngine that hasn't been run #94498

Open gaaclarke opened 2 years ago

gaaclarke commented 2 years ago

The current behavior is Flutter crashing on an assertion.

-(void)viewDidAppear:(BOOL)animated {
  FlutterEngine* engine = [[FlutterEngine alloc] initWithName:@"" project:nil];
  // When the following `run` call is missing erroneously, Flutter just crashes in an assert.
  // We should provide better feedback.
  // [engine run];
  FlutterViewController* viewController = [[FlutterViewController alloc] initWithEngine:engine nibName:nil bundle:nil];
  [self presentViewController:viewController animated:NO completion:nil];
  [super viewDidAppear:animated];
}
buntypn commented 2 years ago

@chinmaygarde I guess throwing NSException with proper message, will work. I am new here, if you guide me, I can take this up.