methodHandler method

Future<void> methodHandler(
  1. MethodCall call
)

This function handles method calls for different modules based on the method name.

Args: call (MethodCall): The parameter call is of type MethodCall, which is a class from the Flutter framework's flutter/services.dart library. It represents a method call from a platform-specific code to the Flutter app. It contains information such as the method name, arguments, and argument types.

Implementation

Future<void> methodHandler(MethodCall call) async {
  var modulePath = call.method.split('#');
  // ignore: unnecessary_type_check
  if (modulePath is List<String> && modulePath.length == 3) {
    var module = modulePath[0];

    if (module == 'Notifications') {
      Synerise.notifications.handleMethod(call);
    } else if (module == 'Injector') {
      Synerise.injector.handleMethod(call);
    }
  }
}