handleMethodCall method

Future handleMethodCall(
  1. MethodCall call
)

Implementation

Future<dynamic> handleMethodCall(MethodCall call) async {
  switch (call.method) {
    case 'saveFile':
      String args = call.arguments;
      Map<String, dynamic> data = json.decode(args);
      List<dynamic> bytes = data['bytes'];
      Uint8List uint8list = Uint8List.fromList(List<int>.from(bytes));
      return downloadFile(
        uint8list,
        data['name'],
        data['type'],
      );
    default:
      throw PlatformException(
        code: 'Unimplemented',
        details: 'at_file_saver for web doesn\'t implement \'${call.method}\'',
      );
  }
}