getIntentAction method

  1. @override
Future<MediaExtentionAction> getIntentAction()
override

This Method is triggered by the Native Thread which sends the intentAction and uri information in a HashMap Structure to the Flutter thread.

Implementation

@override
Future<MediaExtentionAction> getIntentAction() async {
  //Completer which awaits for the result from native android
  //thread to send the IntentAction Information.
  final Completer<MediaExtentionAction> completer =
      Completer<MediaExtentionAction>();
  methodChannel.setMethodCallHandler((call) async {
    final dynamic args = call.arguments;
    MediaExtentionAction intentAction = MediaExtentionAction(
        action: actionParser(args['action']),
        name: args['name'],
        type: mediaParser(args['type']),
        extension: args['extension'],
        data: args['data']);
    //Completes the Completer
    completer.complete(intentAction);
  });
  //Returns the future
  return completer.future;
}