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

Null check operator error #124

Open
MSF01 opened this issue May 8, 2024 · 0 comments
Open

Null check operator error #124

MSF01 opened this issue May 8, 2024 · 0 comments

Comments

@MSF01
Copy link

MSF01 commented May 8, 2024

Hi I am trying to save my location on Firebase RTDB but for some reason when I try to run it I get the runtime error of Null check operator used on a null value

try {
      BackgroundLocator.registerLocationUpdate(
        (LocationDto locationDto) async {
          // Handle location update
          saveLocation(locationDto);
        },
        initCallback: LocationCallbackHandler.initCallback,
        autoStop: false,
        androidSettings: const AndroidSettings(
          accuracy: LocationAccuracy.NAVIGATION,
          interval: 5,
          distanceFilter: 0,
          androidNotificationSettings: AndroidNotificationSettings(
              notificationChannelName: 'Location tracking',
              notificationTitle: 'Start Location Tracking',
              notificationMsg: 'Track location in background',
              notificationBigMsg:
                  'Background location is on to keep the app up-tp-date with your location. This is required for main features to work properly when the app is not running.',
              notificationIconColor: Colors.red,
              notificationTapCallback:
                  LocationCallbackHandler.notificationCallback),
        ),
      );
    } catch (e) {
      print('Exception Caught on fetching location: $e');
    }

And showing error like this
image

Pointing directly at
image

static Map<String, dynamic> _getCommonArgumentsMap(
      {required void Function(LocationDto) callback,
      void Function(Map<String, dynamic>)? initCallback,
      Map<String, dynamic>? initDataCallback,
      void Function()? disposeCallback}) {
    final Map<String, dynamic> args = {
      Keys.ARG_CALLBACK:
          PluginUtilities.getCallbackHandle(callback).toRawHandle(),
    };

    if (initCallback != null) {
      args[Keys.ARG_INIT_CALLBACK] =
          PluginUtilities.getCallbackHandle(initCallback)!.toRawHandle();
    }
    if (disposeCallback != null) {
      args[Keys.ARG_DISPOSE_CALLBACK] =
          PluginUtilities.getCallbackHandle(disposeCallback)!.toRawHandle();
    }
    if (initDataCallback != null) {
      args[Keys.ARG_INIT_DATA_CALLBACK] = initDataCallback;
    }

    return args;
  }
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

1 participant