22/// This grants may have been created via `Intent#FLAG_GRANT_READ_URI_PERMISSION` ,
33/// etc when sending an `Intent` , or explicitly through `Context#grantUriPermission(String, android.net.Uri, int)` .
44///
5- /// [Refer to details] (https://developer.android.com/reference/android/content/UriPermission)
5+ /// [Refer to details] (https://developer.android.com/reference/android/content/UriPermission).
66class UriPermission {
77 /// Even we allow create instances of this class avoid it and use
88 /// `persistedUriPermissions` API instead
@@ -11,6 +11,7 @@ class UriPermission {
1111 required this .isWritePermission,
1212 required this .persistedTime,
1313 required this .uri,
14+ required this .isTreeDocumentFile,
1415 });
1516
1617 factory UriPermission .fromMap (Map <String , dynamic > map) {
@@ -19,6 +20,7 @@ class UriPermission {
1920 isWritePermission: map['isWritePermission' ] as bool ,
2021 persistedTime: map['persistedTime' ] as int ,
2122 uri: Uri .parse (map['uri' ] as String ),
23+ isTreeDocumentFile: map['isTreeDocumentFile' ] as bool ,
2224 );
2325 }
2426
@@ -40,24 +42,41 @@ class UriPermission {
4042 /// [Refer to details] (https://android.googlesource.com/platform/frameworks/base/+/master/core/java/android/content/UriPermission.java#56)
4143 final Uri uri;
4244
45+ /// Whether or not a tree document file.
46+ ///
47+ /// Tree document files are granted through [openDocumentTree] method, that is, when the user select a folder-like tree document file.
48+ /// Document files are granted through [openDocument] method, that is, when the user select (a) specific(s) document files.
49+ ///
50+ /// Roughly you may consider it as a property to verify if [this] permission is over a folder or a single-file.
51+ final bool isTreeDocumentFile;
52+
4353 @override
4454 bool operator == (Object other) =>
4555 other is UriPermission &&
4656 isReadPermission == other.isReadPermission &&
4757 isWritePermission == other.isWritePermission &&
4858 persistedTime == other.persistedTime &&
49- uri == other.uri;
59+ uri == other.uri &&
60+ isTreeDocumentFile == other.isTreeDocumentFile;
5061
5162 @override
52- int get hashCode =>
53- Object .hash (isReadPermission, isWritePermission, persistedTime, uri);
63+ int get hashCode => Object .hashAll (
64+ [
65+ isReadPermission,
66+ isWritePermission,
67+ persistedTime,
68+ uri,
69+ isTreeDocumentFile,
70+ ],
71+ );
5472
5573 Map <String , dynamic > toMap () {
5674 return < String , dynamic > {
5775 'isReadPermission' : isReadPermission,
5876 'isWritePermission' : isWritePermission,
5977 'persistedTime' : persistedTime,
6078 'uri' : '$uri ' ,
79+ 'isTreeDocumentFile' : isTreeDocumentFile,
6180 };
6281 }
6382
@@ -66,5 +85,6 @@ class UriPermission {
6685 'isReadPermission: $isReadPermission , '
6786 'isWritePermission: $isWritePermission , '
6887 'persistedTime: $persistedTime , '
69- 'uri: $uri )' ;
88+ 'uri: $uri , '
89+ 'isTreeDocumentFile: $isTreeDocumentFile )' ;
7090}
0 commit comments