-
Notifications
You must be signed in to change notification settings - Fork 0
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
12 changed files
with
586 additions
and
124 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +0,0 @@ | ||
import 'package:file_picker/file_picker.dart'; | ||
|
||
Future<PlatformFile?> pickFile([List<String> extensions = const ['csv']]) async { | ||
final file = (await FilePicker.platform.pickFiles( | ||
type: FileType.custom, | ||
allowedExtensions: extensions, | ||
withData: true, | ||
))?.files.first; | ||
|
||
if (file == null || file.bytes == null) { | ||
return null; | ||
} | ||
return file; | ||
} | ||
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,20 +1,36 @@ | ||
import 'dart:io'; | ||
|
||
import 'package:file_picker/file_picker.dart'; | ||
import 'package:path_provider/path_provider.dart'; | ||
|
||
import '../logger/logger.dart'; | ||
|
||
/// Save csv to file | ||
Future<File?> saveCsv(String csv, String filename) async { | ||
Future<File?> saveToFile(String content, String filename, [String extension = 'csv']) async { | ||
final directory = | ||
Platform.isAndroid | ||
? await getExternalStorageDirectory() | ||
: await getApplicationDocumentsDirectory(); | ||
if (directory == null) { | ||
return null; | ||
} | ||
final file = File('${directory.path}/$filename.csv'); | ||
await file.writeAsString(csv); | ||
logger.i('saveCsv -> Saved csv to file ${file.path}'); | ||
final file = File('${directory.path}/$filename.$extension'); | ||
await file.writeAsString(content); | ||
logger.i('saveToFile -> Saved $extension to file ${file.path}'); | ||
return file; | ||
} | ||
|
||
|
||
/// Pick file from filesystem | ||
Future<PlatformFile?> pickFile([List<String> extensions = const ['csv']]) async { | ||
final file = (await FilePicker.platform.pickFiles( | ||
type: FileType.custom, | ||
allowedExtensions: extensions, | ||
withData: true, | ||
))?.files.first; | ||
|
||
if (file == null || file.bytes == null) { | ||
return null; | ||
} | ||
return file; | ||
} |
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 |
---|---|---|
|
@@ -126,11 +126,11 @@ sealed class Pubspec { | |
2025, | ||
1, | ||
22, | ||
1, | ||
4, | ||
5, | ||
351, | ||
892, | ||
21, | ||
52, | ||
37, | ||
89, | ||
); | ||
|
||
/// Name | ||
|
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 was deleted.
Oops, something went wrong.
Oops, something went wrong.