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

[path_provider] Make a 0.0.5 for Dart 2.12 compat #3672

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/path_provider/path_provider_windows/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## 2.0.0
## 0.0.5

* Migrate to null safety
* Add compatibility with Dart 2.12.

## 0.0.4+4

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ class MyApp extends StatefulWidget {
}

class _MyAppState extends State<MyApp> {
String? _tempDirectory = 'Unknown';
String? _downloadsDirectory = 'Unknown';
String? _appSupportDirectory = 'Unknown';
String? _documentsDirectory = 'Unknown';
String _tempDirectory = 'Unknown';
String _downloadsDirectory = 'Unknown';
String _appSupportDirectory = 'Unknown';
String _documentsDirectory = 'Unknown';

@override
void initState() {
Expand All @@ -33,10 +33,10 @@ class _MyAppState extends State<MyApp> {

// Platform messages are asynchronous, so we initialize in an async method.
Future<void> initDirectories() async {
String? tempDirectory;
String? downloadsDirectory;
String? appSupportDirectory;
String? documentsDirectory;
String tempDirectory;
String downloadsDirectory;
String appSupportDirectory;
String documentsDirectory;
final PathProviderWindows provider = PathProviderWindows();

try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ flutter:
uses-material-design: true

environment:
sdk: ">=2.12.0-259.9.beta <3.0.0"
sdk: ">=2.11.0 <3.0.0"
flutter: ">=1.20.0"
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import 'folders.dart';
class VersionInfoQuerier {
/// Returns the value for [key] in [versionInfo]s English strings section, or
/// null if there is no such entry, or if versionInfo is null.
getStringValue(Pointer<Uint8>? versionInfo, key) {
getStringValue(Pointer<Uint8> versionInfo, key) {
if (versionInfo == null) {
return null;
}
Expand Down Expand Up @@ -53,7 +53,7 @@ class PathProviderWindows extends PathProviderPlatform {

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

Expand Down Expand Up @@ -87,7 +87,7 @@ class PathProviderWindows extends PathProviderPlatform {
}

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

@override
Future<String?> getApplicationDocumentsPath() =>
Future<String> getApplicationDocumentsPath() =>
getPath(WindowsKnownFolder.Documents);

@override
Future<String?> getDownloadsPath() => getPath(WindowsKnownFolder.Downloads);
Future<String> getDownloadsPath() => getPath(WindowsKnownFolder.Downloads);

/// Retrieve any known folder from Windows.
///
Expand Down Expand Up @@ -151,13 +151,13 @@ class PathProviderWindows extends PathProviderPlatform {
/// - If the product name isn't there, it will use the exe's filename (without
/// extension).
String _getApplicationSpecificSubdirectory() {
String? companyName;
String? productName;
String companyName;
String productName;

final Pointer<Utf16> moduleNameBuffer =
calloc<Uint16>(MAX_PATH + 1).cast<Utf16>();
final Pointer<Uint32> unused = calloc<Uint32>();
Pointer<Uint8>? infoBuffer;
Pointer<Uint8> infoBuffer;
try {
// Get the module name.
final moduleNameLength = GetModuleFileName(0, moduleNameBuffer, MAX_PATH);
Expand Down Expand Up @@ -203,7 +203,7 @@ class PathProviderWindows extends PathProviderPlatform {
/// https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file#naming-conventions
///
/// If after sanitizing the string is empty, returns null.
String? _sanitizedDirectoryName(String? rawString) {
String _sanitizedDirectoryName(String rawString) {
if (rawString == null) {
return null;
}
Expand Down
6 changes: 3 additions & 3 deletions packages/path_provider/path_provider_windows/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: path_provider_windows
description: Windows implementation of the path_provider plugin
homepage: https://github.com/flutter/plugins/tree/master/packages/path_provider/path_provider_windows
version: 2.0.0
version: 0.0.5

flutter:
plugin:
Expand All @@ -11,7 +11,7 @@ flutter:
pluginClass: none

dependencies:
path_provider_platform_interface: ^2.0.0
path_provider_platform_interface: ^1.0.3
meta: ^1.3.0
path: ^1.8.0
flutter:
Expand All @@ -25,5 +25,5 @@ dev_dependencies:
pedantic: ^1.10.0

environment:
sdk: ">=2.12.0-259.9.beta <3.0.0"
sdk: ">=2.11.0 <3.0.0"
flutter: ">=1.20.0"
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class FakeVersionInfoQuerier implements VersionInfoQuerier {

final Map<String, String> responses;

getStringValue(Pointer<Uint8>? versionInfo, key) => responses[key];
getStringValue(Pointer<Uint8> versionInfo, key) => responses[key];
}

void main() {
Expand Down