@@ -88,7 +88,11 @@ class PathProviderWindows extends PathProviderPlatform {
88
88
89
89
@override
90
90
Future <String ?> getApplicationSupportPath () async {
91
- final String appDataRoot = await getPath (WindowsKnownFolder .RoamingAppData );
91
+ final String ? appDataRoot =
92
+ await getPath (WindowsKnownFolder .RoamingAppData );
93
+ if (appDataRoot == null ) {
94
+ return null ;
95
+ }
92
96
final Directory directory = Directory (
93
97
path.join (appDataRoot, _getApplicationSpecificSubdirectory ()));
94
98
// Ensure that the directory exists if possible, since it will on other
@@ -114,7 +118,7 @@ class PathProviderWindows extends PathProviderPlatform {
114
118
///
115
119
/// folderID is a GUID that represents a specific known folder ID, drawn from
116
120
/// [WindowsKnownFolder] .
117
- Future <String > getPath (String folderID) {
121
+ Future <String ? > getPath (String folderID) {
118
122
final Pointer <Pointer <Utf16 >> pathPtrPtr = calloc <Pointer <Utf16 >>();
119
123
final Pointer <GUID > knownFolderID = calloc <GUID >()..ref.setGUID (folderID);
120
124
@@ -130,6 +134,7 @@ class PathProviderWindows extends PathProviderPlatform {
130
134
if (hr == E_INVALIDARG || hr == E_FAIL ) {
131
135
throw WindowsException (hr);
132
136
}
137
+ return Future <String ?>.value (null );
133
138
}
134
139
135
140
final String path = pathPtrPtr.value.toDartString ();
0 commit comments