Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The error is not print to console in debug mode. #76

Open
PandaGeek1024 opened this issue Apr 3, 2019 · 2 comments
Open

The error is not print to console in debug mode. #76

PandaGeek1024 opened this issue Apr 3, 2019 · 2 comments

Comments

@PandaGeek1024
Copy link

I'm developing an iOS app and I followed the example to setup everything and it does send logs to firebase console. But when I set isInDebugMode to true, somehow it just doesn't print it to android studio log. Am I doing something wrong?

Future<void> main() async {

  bool isInDebugMode = true;

  FlutterError.onError = (FlutterErrorDetails details) {
    if (isInDebugMode) {
      // In development mode simply print to console.
      FlutterError.dumpErrorToConsole(details);
    } else {
      // In production mode report to the application zone to report to
      // Crashlytics.
      Zone.current.handleUncaughtError(details.exception, details.stack);
    }
  };

  await FlutterCrashlytics().initialize();

  runZoned<Future<Null>>(() async {
    await Firestore().settings(timestampsInSnapshotsEnabled: true);
    runApp(MaterialApp(
        builder: (buildContext, child) {
          return AppStateProvider.wrap(child);
        },
        home: SplashPage()));
  }, onError: (error, stackTrace) async {
    // Whenever an error occurs, call the `reportCrash` function. This will send
    // Dart errors to our dev console or Crashlytics depending on the environment.
    await FlutterCrashlytics().reportCrash(error, stackTrace, forceCrash: false);
  });
}
@jaumard
Copy link
Contributor

jaumard commented Apr 23, 2019

FlutterError.dumpErrorToConsole should dump your error on the console, if it doesn't, the issue come from flutter I'll say and not this plugin. Use breakpoint to see if FlutterError.dumpErrorToConsole is called or not

@stargazing-dino
Copy link

@PandaGeek1024 I had a similar issue in VSCode. Using the IDE's built-in debugger, my onError was never called. Setting it to null (which should've ignored all errors as stated in these docs) had no effect either.

Running through a terminal with flutter run finally hit the correct handlers and sent the error to the console.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants