save_file_method_channel.dart
867 Bytes
import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart';
import 'save_file_platform_interface.dart';
/// An implementation of [SaveFilePlatform] that uses method channels.
class MethodChannelSaveFile extends SaveFilePlatform {
/// The method channel used to interact with the native platform.
@visibleForTesting
final methodChannel = const MethodChannel('save_file');
@override
Future<String?> getPlatformVersion() async {
final version = await methodChannel.invokeMethod<String>('getPlatformVersion');
return version;
}
@override
Future<String?> saveFile(String path,String fileName) async {
final mapData = <dynamic, dynamic>{};
mapData['path'] = path;
mapData['filename'] = fileName;
final version = await methodChannel.invokeMethod<String>('saveFile',mapData);
return version;
}
}