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

Commit 569a4b7

Browse files
[path_provider] Make a 0.0.5 for Dart 2.12 compat
Anything with a transitive dependency on `path_provider` (which is a lot) is broken on Flutter 1.26 due to Dart FFI changes. path_provider 2.0.0 doesn't have this problem, but for transitive dependencies that means users need to force an override in their pubspec (and more importantly, know that they need to do so). This creates a new minor release to path_provider_windows that uses a 1.26-friendly version of FFI, but has the null safety changes and major version bump backed out, so that transitive dependencies can safely resolve to this working version just by doing a pub update.
1 parent 60d85fd commit 569a4b7

File tree

6 files changed

+23
-23
lines changed

6 files changed

+23
-23
lines changed

packages/path_provider/path_provider_windows/CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
## 2.0.0
1+
## 0.0.5
22

3-
* Migrate to null safety
3+
* Add compatibility with Dart 2.12.
44

55
## 0.0.4+4
66

packages/path_provider/path_provider_windows/example/lib/main.dart

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ class MyApp extends StatefulWidget {
2020
}
2121

2222
class _MyAppState extends State<MyApp> {
23-
String? _tempDirectory = 'Unknown';
24-
String? _downloadsDirectory = 'Unknown';
25-
String? _appSupportDirectory = 'Unknown';
26-
String? _documentsDirectory = 'Unknown';
23+
String _tempDirectory = 'Unknown';
24+
String _downloadsDirectory = 'Unknown';
25+
String _appSupportDirectory = 'Unknown';
26+
String _documentsDirectory = 'Unknown';
2727

2828
@override
2929
void initState() {
@@ -33,10 +33,10 @@ class _MyAppState extends State<MyApp> {
3333

3434
// Platform messages are asynchronous, so we initialize in an async method.
3535
Future<void> initDirectories() async {
36-
String? tempDirectory;
37-
String? downloadsDirectory;
38-
String? appSupportDirectory;
39-
String? documentsDirectory;
36+
String tempDirectory;
37+
String downloadsDirectory;
38+
String appSupportDirectory;
39+
String documentsDirectory;
4040
final PathProviderWindows provider = PathProviderWindows();
4141

4242
try {

packages/path_provider/path_provider_windows/example/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,5 @@ flutter:
2323
uses-material-design: true
2424

2525
environment:
26-
sdk: ">=2.12.0-259.9.beta <3.0.0"
26+
sdk: ">=2.11.0 <3.0.0"
2727
flutter: ">=1.20.0"

packages/path_provider/path_provider_windows/lib/src/path_provider_windows_real.dart

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import 'folders.dart';
2222
class VersionInfoQuerier {
2323
/// Returns the value for [key] in [versionInfo]s English strings section, or
2424
/// null if there is no such entry, or if versionInfo is null.
25-
getStringValue(Pointer<Uint8>? versionInfo, key) {
25+
getStringValue(Pointer<Uint8> versionInfo, key) {
2626
if (versionInfo == null) {
2727
return null;
2828
}
@@ -53,7 +53,7 @@ class PathProviderWindows extends PathProviderPlatform {
5353

5454
/// This is typically the same as the TMP environment variable.
5555
@override
56-
Future<String?> getTemporaryPath() async {
56+
Future<String> getTemporaryPath() async {
5757
final buffer = calloc<Uint16>(MAX_PATH + 1).cast<Utf16>();
5858
String path;
5959

@@ -87,7 +87,7 @@ class PathProviderWindows extends PathProviderPlatform {
8787
}
8888

8989
@override
90-
Future<String?> getApplicationSupportPath() async {
90+
Future<String> getApplicationSupportPath() async {
9191
final appDataRoot = await getPath(WindowsKnownFolder.RoamingAppData);
9292
final directory = Directory(
9393
path.join(appDataRoot, _getApplicationSpecificSubdirectory()));
@@ -104,11 +104,11 @@ class PathProviderWindows extends PathProviderPlatform {
104104
}
105105

106106
@override
107-
Future<String?> getApplicationDocumentsPath() =>
107+
Future<String> getApplicationDocumentsPath() =>
108108
getPath(WindowsKnownFolder.Documents);
109109

110110
@override
111-
Future<String?> getDownloadsPath() => getPath(WindowsKnownFolder.Downloads);
111+
Future<String> getDownloadsPath() => getPath(WindowsKnownFolder.Downloads);
112112

113113
/// Retrieve any known folder from Windows.
114114
///
@@ -151,13 +151,13 @@ class PathProviderWindows extends PathProviderPlatform {
151151
/// - If the product name isn't there, it will use the exe's filename (without
152152
/// extension).
153153
String _getApplicationSpecificSubdirectory() {
154-
String? companyName;
155-
String? productName;
154+
String companyName;
155+
String productName;
156156

157157
final Pointer<Utf16> moduleNameBuffer =
158158
calloc<Uint16>(MAX_PATH + 1).cast<Utf16>();
159159
final Pointer<Uint32> unused = calloc<Uint32>();
160-
Pointer<Uint8>? infoBuffer;
160+
Pointer<Uint8> infoBuffer;
161161
try {
162162
// Get the module name.
163163
final moduleNameLength = GetModuleFileName(0, moduleNameBuffer, MAX_PATH);
@@ -203,7 +203,7 @@ class PathProviderWindows extends PathProviderPlatform {
203203
/// https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file#naming-conventions
204204
///
205205
/// If after sanitizing the string is empty, returns null.
206-
String? _sanitizedDirectoryName(String? rawString) {
206+
String _sanitizedDirectoryName(String rawString) {
207207
if (rawString == null) {
208208
return null;
209209
}

packages/path_provider/path_provider_windows/pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: path_provider_windows
22
description: Windows implementation of the path_provider plugin
33
homepage: https://github.com/flutter/plugins/tree/master/packages/path_provider/path_provider_windows
4-
version: 2.0.0
4+
version: 0.0.5
55

66
flutter:
77
plugin:
@@ -25,5 +25,5 @@ dev_dependencies:
2525
pedantic: ^1.10.0
2626

2727
environment:
28-
sdk: ">=2.12.0-259.9.beta <3.0.0"
28+
sdk: ">=2.11.0 <3.0.0"
2929
flutter: ">=1.20.0"

packages/path_provider/path_provider_windows/test/path_provider_windows_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class FakeVersionInfoQuerier implements VersionInfoQuerier {
1313

1414
final Map<String, String> responses;
1515

16-
getStringValue(Pointer<Uint8>? versionInfo, key) => responses[key];
16+
getStringValue(Pointer<Uint8> versionInfo, key) => responses[key];
1717
}
1818

1919
void main() {

0 commit comments

Comments
 (0)