android – Flutter App – NewRelic Cellular Not Logging and Zone Error Points

android – Flutter App – NewRelic Cellular Not Logging and Zone Error Points


  void predominant() async {
      EndPoints.configure();
  print(AnsiStyles.purple('That is purple!'));
  print('......env.......${EndPoints.env}........${EndPoints.baseUrl}');
  var appToken = "";
  if (Platform.isIOS) {
    appToken = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-NRMA';
  } else if (Platform.isAndroid) {
    appToken = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-NRMA';
  }

  Config config = Config(
      accessToken: appToken,
      analyticsEventEnabled: true,
      webViewInstrumentation: true,
      networkErrorRequestEnabled: true,
      networkRequestEnabled: true,
      crashReportingEnabled: true,
      interactionTracingEnabled: true,
      httpResponseBodyCaptureEnabled: true,
      loggingEnabled: true,
      printStatementAsEventsEnabled: true,
      httpInstrumentationEnabled: true);
  BindingBase.debugZoneErrorsAreFatal = false;
  WidgetsFlutterBinding.ensureInitialized();

  SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
    systemNavigationBarColor: Colours.white,
    statusBarColor: Colours.white.withOpacity(0.5),
    statusBarBrightness: Brightness.darkish,
    statusBarIconBrightness: Brightness.darkish,
  ));
  SystemChrome.setEnabledSystemUIMode(SystemUiMode.handbook,
      overlays: [SystemUiOverlay.bottom, SystemUiOverlay.top]);
  SystemChrome.setPreferredOrientations([
    DeviceOrientation.portraitUp,
    DeviceOrientation.portraitDown,
  ]);
  await ChargeStationsDatabaseHelper.initDatabase();
  FirebaseOptions androidOptions = FirebaseOptions(
      apiKey: "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
      appId: "1:XXXXXXXXXXXX:android:XXXXXXXXXXXXXXXXXXXXX",
      messagingSenderId: "XXXXXXXXXXXX",
      projectId: "XXXXXXXXXXXX");
  FirebaseOptions iosOptions = FirebaseOptions(
      apiKey: "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
      appId: "1:XXXXXXXXXXXX:ios:XXXXXXXXXXXXXXXXXXXXX",
      messagingSenderId: "XXXXXXXXXXXX",
      projectId: "XXXXXXXXXXXX");

  await Firebase.initializeApp(
    choices: Platform.isAndroid ? androidOptions : iosOptions,
  );
  await FirebaseApi().initPushNotifications();
  FirebaseAnalyticsObserver(analytics: FirebaseAnalytics.occasion);
  FirebaseAnalytics.occasion.setAnalyticsCollectionEnabled(true);
  FirebaseCrashlytics.occasion.setCrashlyticsCollectionEnabled(true);
  FlutterError.onError = FirebaseCrashlytics.occasion.recordFlutterError;

  NewrelicMobile.occasion.begin(config, () {
    runZonedGuarded(() async {
      // Push notification code commented out
      /* 
      await PushNotificationService
          .requestPushNotificationPermission()
          .then((worth) async {
            await PushNotificationService
                .registerDevice();
          });
      await FirebaseApi()
          .initNotifications();
    */

      // Sentry code commented out
      runApp(initalApp());
      
    }, (error, stackTrace) {
      FirebaseCrashlytics.occasion.recordError(error, stackTrace);
    });
  });
}

The Flutter bindings had been initialized in a special zone than is now
getting used. It will seemingly trigger confusion and bugs as any
zone-specific configuration will inconsistently use the configuration
of the unique binding initialization zone or this zone primarily based on
hard-to-predict components comparable to which zone was energetic when a
specific callback was set. It is very important use the identical zone when
calling ensureInitialized on the binding as when calling runApp
later. To make this warning deadly, set
BindingBase.debugZoneErrorsAreFatal to true earlier than the bindings are
initialized (i.e. as the primary assertion in void predominant() { }).

When the exception was thrown, this was the stack:
#0 BindingBase.debugCheckZone. (bundle:flutter/src/basis/binding.dart:495:29) binding.dart:495
#1 BindingBase.debugCheckZone (bundle:flutter/src/basis/binding.dart:500:6) binding.dart:500
#2 runApp (bundle:flutter/src/widgets/binding.dart:1212:18) binding.dart:1212
#3 predominant.. (bundle:ev/predominant.dart:189:7) predominant.dart:189
#8 predominant. (bundle:ev/predominant.dart:160:5) predominant.dart:160
#9 NewrelicMobile.begin. (bundle:newrelic_mobile/newrelic_mobile.dart:42:13)
newrelic_mobile.dart:42 (elided 4 frames
from dart:async)

 NewrelicMobile.occasion.log(
    LogLevel.ERROR,
    eventName,
  );
  await NewrelicMobile.occasion.recordCustomEvent(
    "analytics",
    eventName: eventName,
    eventAttributes: params,
  );

Additionally this perform isn’t logging something in my newrelic dashboard.

Leave a Reply

Your email address will not be published. Required fields are marked *