-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
115 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,44 @@ | ||
import 'package:flutter/services.dart'; | ||
|
||
class PlatformFilePicker { | ||
static const MethodChannel _channel = MethodChannel('net.sunjiao.renamer/picker'); | ||
static const MethodChannel _channel = | ||
MethodChannel('net.sunjiao.renamer/picker'); | ||
|
||
static Future<void> dirAccess() async { | ||
static Future<List<Object?>?> dirAccess() async { | ||
try { | ||
await _channel.invokeMethod('dirAccess'); | ||
return await _channel.invokeMethod('dirAccess'); | ||
} on PlatformException catch (e) { | ||
// show error message | ||
rethrow; | ||
} | ||
} | ||
|
||
static Future<void> renameFile() async { | ||
static Future<List<Object?>?> fileAccess(String startPath) async { | ||
try { | ||
await _channel.invokeMethod('renameFile'); | ||
return await _channel.invokeMethod( | ||
'fileAccess', | ||
{ | ||
'startPath': startPath, | ||
}, | ||
); | ||
} on PlatformException catch (e) { | ||
// show error message | ||
rethrow; | ||
} | ||
} | ||
|
||
static Future<bool> renameFile(String oldPath, String newPath) async { | ||
try { | ||
return await _channel.invokeMethod( | ||
'renameFile', | ||
{ | ||
'oldPath': oldPath, | ||
'newPath': newPath, | ||
}, | ||
); | ||
} on PlatformException catch (e) { | ||
// show error message | ||
rethrow; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters