handlePlatformCalls method

void handlePlatformCalls(
  1. MethodCall call,
  2. JawalConfig config
)

Implementation

void handlePlatformCalls(MethodCall call, JawalConfig config) async {
  switch (call.method) {
    case "onInitResult":
      if (config.onInitResult != null) {
        InitResultEvent event =
            InitResultEvent.fromJson(jsonDecode(call.arguments));
        config.onInitResult!(event);
      }
      break;
    case "onLocationChange":
      if (_onLocationChange != null) {
        _onLocationChange!(
            LocationChangeEvent.fromJson(jsonDecode(call.arguments)));
      }
      break;
    case "onLocationPermissionResult":
      _foregroundLocationPermissionCompleter
          ?.complete(PermissionStatus.fromJson(jsonDecode(call.arguments)));
      break;
    case "onBackgroundLocationPermissionResult":
      _backgroundLocationPermissionCompleter
          ?.complete(PermissionStatus.fromJson(jsonDecode(call.arguments)));
      break;
    default:
      throw MissingPluginException();
  }
}