mirror of
https://github.com/foss42/apidash.git
synced 2025-06-08 21:08:00 +08:00
Show error message for incorrect file import
This commit is contained in:
@ -47,7 +47,8 @@ class CollectionPane extends ConsumerWidget {
|
|||||||
},
|
},
|
||||||
onFileDropped: (file) {
|
onFileDropped: (file) {
|
||||||
final importFormatType = ref.read(importFormatStateProvider);
|
final importFormatType = ref.read(importFormatStateProvider);
|
||||||
file.readAsString().then((content) {
|
file.readAsString().then(
|
||||||
|
(content) {
|
||||||
kImporter
|
kImporter
|
||||||
.getHttpRequestModel(importFormatType, content)
|
.getHttpRequestModel(importFormatType, content)
|
||||||
.then((importedRequestModel) {
|
.then((importedRequestModel) {
|
||||||
@ -56,10 +57,16 @@ class CollectionPane extends ConsumerWidget {
|
|||||||
.read(collectionStateNotifierProvider.notifier)
|
.read(collectionStateNotifierProvider.notifier)
|
||||||
.addRequestModel(importedRequestModel);
|
.addRequestModel(importedRequestModel);
|
||||||
} else {
|
} else {
|
||||||
// TODO: Throw an error, unable to parse
|
// TODO: show in status bar
|
||||||
|
debugPrint("Unable to parse ${file.name}");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
},
|
||||||
|
onError: (e) {
|
||||||
|
// TODO: show in status bar
|
||||||
|
debugPrint("Unable to import ${file.name}");
|
||||||
|
},
|
||||||
|
);
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
Reference in New Issue
Block a user