Skip to content

Commit 4f5c98e

Browse files
author
lakscastro
committed
(#100) Update docs to match latest breaking changes
1 parent f619efd commit 4f5c98e

File tree

4 files changed

+48
-8
lines changed

4 files changed

+48
-8
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ dependencies:
77
shared_storage: v0.3.0
88
```
99
10-
## SDK Constraint
10+
## SDK constraint
1111
1212
In `android\app\build.gradle` set `android.defaultConfig.minSdkVersion` to `19`:
1313

@@ -22,7 +22,7 @@ android {
2222
}
2323
```
2424

25-
## Plugin Import
25+
## Plugin import
2626

2727
Although this import is still supported:
2828

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
There's major breaking changes when updating to `v0.5.0`, be careful.
2+
3+
Update your `pubspec.yaml`:
4+
5+
```yaml
6+
dependencies:
7+
shared_storage: ^0.5.0
8+
```
9+
10+
## Return type of `listFiles`
11+
12+
Instead of:
13+
14+
```dart
15+
Stream<PartialDocumentFile> fileStream = listFiles(uri);
16+
```
17+
18+
use:
19+
20+
```dart
21+
Stream<DocumentFile> fileStream = listFiles(uri);
22+
```
23+
24+
And when reading data from each file:
25+
26+
```dart
27+
// Old.
28+
PartialDocumentFile file = ...
29+
30+
String displayName = file.data![DocumentFileColumn.displayName] as String;
31+
DateTime lastModified = DateTime.fromMillisecondsSinceEpoch(file.data![DocumentFileColumn.lastModified] as int);
32+
33+
// New.
34+
DocumentFile file = ...
35+
36+
String displayName = file.name;
37+
DateTime lastModified = file.lastModified;
38+
```
39+
40+
It now parses all fields as class fields instead `Map<DocumentFileColumn, dynamic>` hash map.

docs/Usage/Storage Access Framework.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,9 @@ const List<DocumentFileColumn> columns = <DocumentFileColumn>[
8989
DocumentFileColumn.mimeType,
9090
];
9191
92-
final List<PartialDocumentFile> files = [];
92+
final List<DocumentFile> files = [];
9393
94-
final Stream<PartialDocumentFile> onNewFileLoaded = documentFileOfMyGrantedUri.listFiles(columns);
94+
final Stream<DocumentFile> onNewFileLoaded = documentFileOfMyGrantedUri.listFiles(columns);
9595
9696
onNewFileLoaded.listen((file) => files.add(file), onDone: () => print('All files were loaded'));
9797
```
@@ -299,7 +299,7 @@ Returns the image thumbnail of a given `uri`, if any (e.g documents that can sho
299299

300300
```dart
301301
final Uint8List? imageBytes;
302-
final PartialDocumentFile file = ...
302+
final DocumentFile file = ...
303303
304304
final Uri? rootUri = file.metadata?.rootUri;
305305
final String? documentId = file.data?[DocumentFileColumn.id] as String?;
@@ -345,7 +345,7 @@ const List<DocumentFileColumn> columns = <DocumentFileColumn>[
345345
DocumentFileColumn.mimeType,
346346
];
347347
348-
final Stream<PartialDocumentFile> onNewFileLoaded = documentFileOfMyGrantedUri.listFiles(columns);
348+
final Stream<DocumentFile> onNewFileLoaded = documentFileOfMyGrantedUri.listFiles(columns);
349349
```
350350

351351
### <samp>delete</samp>
@@ -645,7 +645,7 @@ This class is not intended to be instantiated, and it is only used for typing an
645645

646646
### <samp>QueryMetadata</samp>
647647

648-
This class wraps useful metadata of the source queries returned by the `PartialDocumentFile`.
648+
This class wraps useful metadata of the source queries returned by the `DocumentFile`.
649649

650650
This class is not intended to be instantiated, and it is only used for typing and convenience purposes.
651651

lib/src/saf/saf.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ Future<DocumentBitmap?> getDocumentThumbnail({
129129
/// ```dart
130130
/// /// Usage:
131131
///
132-
/// final myState = <PartialDocumentFile>[];
132+
/// final myState = <DocumentFile>[];
133133
///
134134
/// final onDocumentFile = listFiles(myUri, [DocumentFileColumn.id]);
135135
///

0 commit comments

Comments
 (0)