handleMethodCall method

Future handleMethodCall(
  1. MethodCall call
)

Handles method calls over the MethodChannel of this plugin. Note: Check the "federated" architecture for a new way of doing this: https://flutter.dev/go/federated-plugins

Implementation

Future<dynamic> handleMethodCall(MethodCall call) async {
  switch (call.method) {
    case 'fetch':
      return fetchLocation();
    case 'start':
      _timer?.cancel();
      _timer = null;
      return listenLocation(call.arguments);
    case 'stop':
      _timer?.cancel();
      _timer = null;
      return Future.value(null);
    case 'enableBackground':
      return Future.value(null);
    case 'disableBackground':
      return Future.value(null);
    default:
      throw PlatformException(
        code: 'Unimplemented',
        details: 'amap_location_muka for web doesn\'t implement \'${call.method}\'',
      );
  }
}