saveFile method

  1. @override
Future<SaveInfo?> saveFile({
  1. required String tempFilePath,
  2. required String fileName,
  3. required DirType dirType,
  4. required DirName dirName,
  5. required String relativePath,
})
override

Implementation

@override
Future<SaveInfo?> saveFile({
  required String tempFilePath,
  required String fileName,
  required DirType dirType,
  required DirName dirName,
  required String relativePath,
}) async {
  final string = await methodChannel.invokeMethod<String?>('saveFile', {
    "tempFilePath": tempFilePath,
    "fileName": fileName,
    "dirType": dirType.index,
    "dirName": dirName.folder,
    "appFolder": relativePath,
  });

  final jsonString = (string ?? '');
  final json = jsonDecode(jsonString);
  try {
    return SaveInfo.fromJson(json);
  } catch (e) {
    return null;
  }
}