handleMethodCall method

Future handleMethodCall(
  1. MethodCall call
)

Handles method calls from the Flutter code.

If the method call is 'restartApp', it calls the restart method with the given webOrigin. Otherwise, throws a PlatformException for unrecognized method calls.

Implementation

Future<dynamic> handleMethodCall(MethodCall call) async {
  switch (call.method) {
    case 'restartApp':
      final args = call.arguments as Map?;
      final webOrigin = args?['webOrigin'] as String?;
      return restart(webOrigin);
    default:
      throw PlatformException(
        code: 'Unimplemented',
        message: '${call.method} is not implemented on the web platform.',
      );
  }
}