initMethodCallHandler method

dynamic initMethodCallHandler()

Implementation

initMethodCallHandler() {
  assert(
      channel != null, 'Method Channel for ${runtimeType} not initialized!');
  assert(handler != null,
      'Method Call Handler for ${runtimeType} not initialized!');

  channel?.setMethodCallHandler((call) async {
    if (disposed) return null;
    try {
      return await handler!(call);
    } on Error catch (e) {
      print(e);
      print(e.stackTrace);
    }
  });
}