|
1 |
| -# storage_path_example |
| 1 | +# StoragePath |
2 | 2 |
|
3 |
| -Demonstrates how to use the storage_path plugin. |
| 3 | +A flutter plugin to get image, audio, video and files path. |
4 | 4 |
|
5 |
| -## Getting Started |
| 5 | +> Only for Android. |
| 6 | +> If you like this plugin, buy me a cup of coffee. |
| 7 | +> [PayPal](https://www.paypal.me/follow2vivek/) |
6 | 8 |
|
7 |
| -This project is a starting point for a Flutter application. |
| 9 | +```dart |
| 10 | +dependencies: |
| 11 | + storage_path: ^0.1.0 |
| 12 | +``` |
8 | 13 |
|
9 |
| -A few resources to get you started if this is your first Flutter project: |
10 | 14 |
|
11 |
| -- [Lab: Write your first Flutter app](https://flutter.io/docs/get-started/codelab) |
12 |
| -- [Cookbook: Useful Flutter samples](https://flutter.io/docs/cookbook) |
| 15 | +```dart |
| 16 | +import 'package:storage_path/storage_path.dart'; |
| 17 | +``` |
| 18 | +Sample Code |
| 19 | +```dart |
| 20 | + try { |
| 21 | + imagePath = await StoragePath.imagesPath; //contains images path and folder name in json format |
| 22 | + } on PlatformException { |
| 23 | + imagesPath = 'Failed to get path'; |
| 24 | + } |
| 25 | +``` |
| 26 | +AND |
13 | 27 |
|
14 |
| -For help getting started with Flutter, view our |
15 |
| -[online documentation](https://flutter.io/docs), which offers tutorials, |
16 |
| -samples, guidance on mobile development, and a full API reference. |
| 28 | +```dart |
| 29 | +videoPath = await StoragePath.videoPath; |
| 30 | +audioPath = await StoragePath.audioPath; |
| 31 | +filePath = await StoragePath.filePath; |
| 32 | +``` |
| 33 | + |
| 34 | +Image Json Sample |
| 35 | + ```json |
| 36 | + |
| 37 | +[ |
| 38 | + { |
| 39 | + "files": [ |
| 40 | + "path/screenshot/abc.png", |
| 41 | + "path/screenshot/pqr.png" |
| 42 | + ], |
| 43 | + "folderName": "screenshot" |
| 44 | + } |
| 45 | +] |
| 46 | + ``` |
| 47 | +File Json Sample |
| 48 | +```json |
| 49 | +[ |
| 50 | + { |
| 51 | + "files": [ |
| 52 | + { |
| 53 | + "mimeType": "application/pdf", |
| 54 | + "size": "34113", |
| 55 | + "title": "C001-SP-2719^201902", |
| 56 | + "path": "/storage/emulated/0/Download/abc.pdf" |
| 57 | + } |
| 58 | + ], |
| 59 | + "folderName": "Download" |
| 60 | + } |
| 61 | +] |
| 62 | +``` |
| 63 | +Audio Json Sample |
| 64 | +```json |
| 65 | +[ |
| 66 | + { |
| 67 | + "files": [ |
| 68 | + { |
| 69 | + "album": "ABC", |
| 70 | + "artist": "PQR", |
| 71 | + "path": "/storage/emulated/0/Download/todo.mp3", |
| 72 | + "dateAdded": "1515060080", |
| 73 | + "displayName": "todo.mp3", |
| 74 | + "duration": "235986", |
| 75 | + "size": "9506989" |
| 76 | + } |
| 77 | + ], |
| 78 | + "folderName": "Download" |
| 79 | + } |
| 80 | +] |
| 81 | +``` |
| 82 | +Video Json Sample |
| 83 | +```json |
| 84 | +[ |
| 85 | + { |
| 86 | + "files": [ |
| 87 | + { |
| 88 | + "path": "/storage/emulated/0/DCIM/Camera/VID_20190304_112455.mp4", |
| 89 | + "dateAdded": "1551678904", |
| 90 | + "displayName": "VID_20190304_112455.mp4", |
| 91 | + "duration": "7147", |
| 92 | + "size": "12787914" |
| 93 | + } |
| 94 | + ], |
| 95 | + "folderName": "Camera" |
| 96 | + } |
| 97 | +] |
| 98 | +``` |
0 commit comments