Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion packages/path_provider/path_provider/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## NEXT
## 2.0.8

* Updates example app Android compileSdkVersion to 31.
* Removes obsolete manual registration of Windows and Linux implementations.

## 2.0.7

Expand Down
29 changes: 3 additions & 26 deletions packages/path_provider/path_provider/lib/path_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'dart:io' show Directory, Platform;
import 'dart:io' show Directory;

import 'package:flutter/foundation.dart' show kIsWeb, visibleForTesting;
import 'package:path_provider_linux/path_provider_linux.dart';
import 'package:flutter/foundation.dart' show visibleForTesting;
import 'package:path_provider_platform_interface/path_provider_platform_interface.dart';
// ignore: implementation_imports
import 'package:path_provider_platform_interface/src/method_channel_path_provider.dart';
import 'package:path_provider_windows/path_provider_windows.dart';

export 'package:path_provider_platform_interface/path_provider_platform_interface.dart'
show StorageDirectory;
Expand All @@ -18,8 +14,6 @@ export 'package:path_provider_platform_interface/path_provider_platform_interfac
@Deprecated('This is no longer necessary, and is now a no-op')
set disablePathProviderPlatformOverride(bool override) {}

bool _manualDartRegistrationNeeded = true;

/// An exception thrown when a directory that should always be available on
/// the current platform cannot be obtained.
class MissingPlatformDirectoryException implements Exception {
Expand All @@ -41,24 +35,7 @@ class MissingPlatformDirectoryException implements Exception {
}
}

PathProviderPlatform get _platform {
// TODO(egarciad): Remove once auto registration lands on Flutter stable.
// https://github.com/flutter/flutter/issues/81421.
if (_manualDartRegistrationNeeded) {
// Only do the initial registration if it hasn't already been overridden
// with a non-default instance.
if (!kIsWeb && PathProviderPlatform.instance is MethodChannelPathProvider) {
if (Platform.isLinux) {
PathProviderPlatform.instance = PathProviderLinux();
} else if (Platform.isWindows) {
PathProviderPlatform.instance = PathProviderWindows();
}
}
_manualDartRegistrationNeeded = false;
}

return PathProviderPlatform.instance;
}
PathProviderPlatform get _platform => PathProviderPlatform.instance;

/// Path to the temporary directory on the device that is not backed up and is
/// suitable for storing caches of downloaded files.
Expand Down
6 changes: 3 additions & 3 deletions packages/path_provider/path_provider/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: path_provider
description: Flutter plugin for getting commonly used locations on host platform file systems, such as the temp and app data directories.
repository: https://github.com/flutter/plugins/tree/master/packages/path_provider/path_provider
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+path_provider%22
version: 2.0.7
version: 2.0.8

environment:
sdk: ">=2.14.0 <3.0.0"
Expand All @@ -27,10 +27,10 @@ dependencies:
sdk: flutter
path_provider_android: ^2.0.6
path_provider_ios: ^2.0.6
path_provider_linux: ^2.0.0
path_provider_linux: ^2.0.1
path_provider_macos: ^2.0.0
path_provider_platform_interface: ^2.0.0
path_provider_windows: ^2.0.0
path_provider_windows: ^2.0.2

dev_dependencies:
flutter_driver:
Expand Down