Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

[path_provider] Log errors in the linux example #3146

Merged
merged 6 commits into from
Nov 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion packages/path_provider/path_provider_linux/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.1.1+2

* Log errors in the example when calls to the `path_provider` fail.

## 0.1.1+1

* Check in linux/ directory for example/
Expand All @@ -19,4 +23,3 @@
## 0.0.1
* The initial implementation of path_provider for Linux
* Implements getApplicationSupportPath, getApplicationDocumentsPath, getDownloadsPath, and getTemporaryPath

12 changes: 8 additions & 4 deletions packages/path_provider/path_provider_linux/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,25 +35,29 @@ class _MyAppState extends State<MyApp> {
// Platform messages may fail, so we use a try/catch PlatformException.
try {
tempDirectory = (await getTemporaryDirectory()).path;
} on PlatformException {
} on PlatformException catch (e, stackTrace) {
tempDirectory = 'Failed to get temp directory.';
print('$tempDirectory $e $stackTrace');
}
try {
downloadsDirectory = (await getDownloadsDirectory()).path;
} on PlatformException {
} on PlatformException catch (e, stackTrace) {
downloadsDirectory = 'Failed to get downloads directory.';
print('$downloadsDirectory $e $stackTrace');
}

try {
documentsDirectory = (await getApplicationDocumentsDirectory()).path;
} on PlatformException {
} on PlatformException catch (e, stackTrace) {
documentsDirectory = 'Failed to get documents directory.';
print('$documentsDirectory $e $stackTrace');
}

try {
appSupportDirectory = (await getApplicationSupportDirectory()).path;
} on PlatformException {
} on PlatformException catch (e, stackTrace) {
appSupportDirectory = 'Failed to get documents directory.';
print('$appSupportDirectory $e $stackTrace');
}
// If the widget was removed from the tree while the asynchronous platform
// message was in flight, we want to discard the reply rather than calling
Expand Down
2 changes: 1 addition & 1 deletion packages/path_provider/path_provider_linux/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: path_provider_linux
description: linux implementation of the path_provider plugin
version: 0.1.1+1
version: 0.1.1+2
homepage: https://github.com/flutter/plugins/tree/master/packages/path_provider/path_provider_linux

flutter:
Expand Down