File tree 25 files changed +107
-23
lines changed
connectivity/connectivity_macos
shared_preferences_windows
25 files changed +107
-23
lines changed Original file line number Diff line number Diff line change
1
+ ## 0.2.1
2
+
3
+ * Add ` implements ` to pubspec.yaml.
4
+
1
5
## 0.2.0
2
6
3
7
* Remove placeholder Dart file.
Original file line number Diff line number Diff line change 1
1
name : connectivity_macos
2
2
description : macOS implementation of the connectivity plugin.
3
- version : 0.2.0
3
+ version : 0.2.1
4
4
homepage : https://github.com/flutter/plugins/tree/master/packages/connectivity/connectivity_macos
5
5
6
6
flutter :
7
7
plugin :
8
+ implements : connectivity_platform_interface
8
9
platforms :
9
10
macos :
10
11
pluginClass : ConnectivityPlugin
@@ -16,6 +17,13 @@ environment:
16
17
dependencies :
17
18
flutter :
18
19
sdk : flutter
20
+ # The implementation of this plugin doesn't explicitly depend on the method channel
21
+ # defined in the platform interface.
22
+ # To prevent potential breakages, this dependency is added.
23
+ #
24
+ # In the future, this plugin's platform code should be able to reference the
25
+ # interface's platform code. (Android already supports this).
26
+ connectivity_platform_interface : ^2.0.0
19
27
20
28
dev_dependencies :
21
29
pedantic : ^1.10.0
Original file line number Diff line number Diff line change @@ -42,9 +42,8 @@ class MissingPlatformDirectoryException implements Exception {
42
42
}
43
43
44
44
PathProviderPlatform get _platform {
45
- // This is to manually endorse Dart implementations until automatic
46
- // registration of Dart plugins is implemented. For details see
47
- // https://github.com/flutter/flutter/issues/52267.
45
+ // TODO(egarciad): Remove once auto registration lands on Flutter stable.
46
+ // https://github.com/flutter/flutter/issues/81421.
48
47
if (_manualDartRegistrationNeeded) {
49
48
// Only do the initial registration if it hasn't already been overridden
50
49
// with a non-default instance.
Original file line number Diff line number Diff line change
1
+ ## 2.0.1
2
+
3
+ * Add ` implements ` to pubspec.yaml.
4
+ * Add ` registerWith ` method to the main Dart class.
5
+
1
6
## 2.0.0
2
7
3
8
* Migrate to null safety.
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ import 'package:xdg_directories/xdg_directories.dart' as xdg;
13
13
/// This class implements the `package:path_provider` functionality for linux
14
14
class PathProviderLinux extends PathProviderPlatform {
15
15
/// Registers this class as the default instance of [PathProviderPlatform]
16
- static void register () {
16
+ static void registerWith () {
17
17
PathProviderPlatform .instance = PathProviderLinux ();
18
18
}
19
19
Original file line number Diff line number Diff line change 1
1
name : path_provider_linux
2
2
description : linux implementation of the path_provider plugin
3
- version : 2.0.0
3
+ version : 2.0.1
4
4
homepage : https://github.com/flutter/plugins/tree/master/packages/path_provider/path_provider_linux
5
5
6
6
flutter :
7
7
plugin :
8
+ implements : path_provider
8
9
platforms :
9
10
linux :
10
11
dartPluginClass : PathProviderLinux
Original file line number Diff line number Diff line change @@ -7,11 +7,11 @@ import 'package:path_provider_platform_interface/path_provider_platform_interfac
7
7
8
8
void main () {
9
9
TestWidgetsFlutterBinding .ensureInitialized ();
10
- PathProviderLinux .register ();
10
+ PathProviderLinux .registerWith ();
11
11
12
- setUp ( () {});
13
-
14
- tearDown (() { });
12
+ test ( 'registered instance' , () {
13
+ expect ( PathProviderPlatform .instance, isA < PathProviderLinux >());
14
+ });
15
15
16
16
test ('getTemporaryPath' , () async {
17
17
final PathProviderPlatform plugin = PathProviderPlatform .instance;
Original file line number Diff line number Diff line change
1
+ ## 2.0.1
2
+
3
+ * Add ` implements ` to pubspec.yaml.
4
+
1
5
## 2.0.0
2
6
3
7
* Update Dart SDK constraint for null safety compatibility.
Original file line number Diff line number Diff line change 1
1
name : path_provider_macos
2
2
description : macOS implementation of the path_provider plugin
3
- version : 2.0.0
3
+ version : 2.0.1
4
4
homepage : https://github.com/flutter/plugins/tree/master/packages/path_provider/path_provider_macos
5
5
6
6
flutter :
7
7
plugin :
8
+ implements : path_provider
8
9
platforms :
9
10
macos :
10
11
pluginClass : PathProviderPlugin
Original file line number Diff line number Diff line change
1
+ ## 2.0.2
2
+
3
+ * Add ` implements ` to pubspec.yaml.
4
+ * Add ` registerWith() ` to the Dart main class.
5
+
1
6
## 2.0.1
2
7
3
8
* Fix a crash when a known folder can't be located.
Original file line number Diff line number Diff line change @@ -47,6 +47,11 @@ class VersionInfoQuerier {
47
47
///
48
48
/// This class implements the `package:path_provider` functionality for Windows.
49
49
class PathProviderWindows extends PathProviderPlatform {
50
+ /// Registers the Windows implementation.
51
+ static void registerWith () {
52
+ PathProviderPlatform .instance = PathProviderWindows ();
53
+ }
54
+
50
55
/// The object to use for performing VerQueryValue calls.
51
56
@visibleForTesting
52
57
VersionInfoQuerier versionInfoQuerier = VersionInfoQuerier ();
Original file line number Diff line number Diff line change @@ -16,6 +16,11 @@ class PathProviderWindows extends PathProviderPlatform {
16
16
/// compile-time dependencies, and should never actually be created.
17
17
PathProviderWindows () : assert (false );
18
18
19
+ /// Registers the Windows implementation.
20
+ static void registerWith () {
21
+ PathProviderPlatform .instance = PathProviderWindows ();
22
+ }
23
+
19
24
/// Stub; see comment on VersionInfoQuerier.
20
25
VersionInfoQuerier versionInfoQuerier = VersionInfoQuerier ();
21
26
Original file line number Diff line number Diff line change 1
1
name : path_provider_windows
2
2
description : Windows implementation of the path_provider plugin
3
3
homepage : https://github.com/flutter/plugins/tree/master/packages/path_provider/path_provider_windows
4
- version : 2.0.1
4
+ version : 2.0.2
5
5
6
6
flutter :
7
7
plugin :
8
+ implements : path_provider
8
9
platforms :
9
10
windows :
10
11
dartPluginClass : PathProviderWindows
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import 'dart:ffi';
5
5
import 'dart:io' ;
6
6
7
7
import 'package:flutter_test/flutter_test.dart' ;
8
+ import 'package:path_provider_platform_interface/path_provider_platform_interface.dart' ;
8
9
import 'package:path_provider_windows/path_provider_windows.dart' ;
9
10
10
11
// A fake VersionInfoQuerier that just returns preset responses.
@@ -18,6 +19,11 @@ class FakeVersionInfoQuerier implements VersionInfoQuerier {
18
19
}
19
20
20
21
void main () {
22
+ test ('registered instance' , () {
23
+ PathProviderWindows .registerWith ();
24
+ expect (PathProviderPlatform .instance, isA <PathProviderWindows >());
25
+ });
26
+
21
27
test ('getTemporaryPath' , () async {
22
28
final PathProviderWindows pathProvider = PathProviderWindows ();
23
29
expect (await pathProvider.getTemporaryPath (), contains (r'C:\' ));
Original file line number Diff line number Diff line change @@ -24,9 +24,8 @@ class SharedPreferences {
24
24
static bool _manualDartRegistrationNeeded = true ;
25
25
26
26
static SharedPreferencesStorePlatform get _store {
27
- // This is to manually endorse the Linux implementation until automatic
28
- // registration of dart plugins is implemented. For details see
29
- // https://github.com/flutter/flutter/issues/52267.
27
+ // TODO(egarciad): Remove once auto registration lands on Flutter stable.
28
+ // https://github.com/flutter/flutter/issues/81421.
30
29
if (_manualDartRegistrationNeeded) {
31
30
// Only do the initial registration if it hasn't already been overridden
32
31
// with a non-default instance.
Original file line number Diff line number Diff line change
1
+ ## 2.0.1
2
+
3
+ * Add ` implements ` to the pubspec.
4
+ * Add ` registerWith ` to the Dart main class.
5
+
1
6
## 2.0.0
2
7
3
8
* Migrate to null-safety.
Original file line number Diff line number Diff line change @@ -17,8 +17,15 @@ import 'package:shared_preferences_platform_interface/shared_preferences_platfor
17
17
/// This class implements the `package:shared_preferences` functionality for Linux.
18
18
class SharedPreferencesLinux extends SharedPreferencesStorePlatform {
19
19
/// The default instance of [SharedPreferencesLinux] to use.
20
+ /// TODO(egarciad): Remove when the Dart plugin registrant lands on Flutter stable.
21
+ /// https://github.com/flutter/flutter/issues/81421
20
22
static SharedPreferencesLinux instance = SharedPreferencesLinux ();
21
23
24
+ /// Registers the Linux implementation.
25
+ static void registerWith () {
26
+ SharedPreferencesStorePlatform .instance = instance;
27
+ }
28
+
22
29
/// Local copy of preferences
23
30
Map <String , Object >? _cachedPreferences;
24
31
Original file line number Diff line number Diff line change 1
1
name : shared_preferences_linux
2
2
description : Linux implementation of the shared_preferences plugin
3
- version : 2.0.0
3
+ version : 2.0.1
4
4
homepage : https://github.com/flutter/plugins/tree/master/packages/shared_preferences/shared_preferences_linux
5
5
6
6
flutter :
7
7
plugin :
8
+ implements : shared_preferences
8
9
platforms :
9
10
linux :
10
11
dartPluginClass : SharedPreferencesLinux
Original file line number Diff line number Diff line change @@ -6,16 +6,17 @@ import 'package:flutter_test/flutter_test.dart';
6
6
import 'package:path/path.dart' as path;
7
7
import 'package:path_provider_linux/path_provider_linux.dart' ;
8
8
import 'package:shared_preferences_linux/shared_preferences_linux.dart' ;
9
+ import 'package:shared_preferences_platform_interface/shared_preferences_platform_interface.dart' ;
9
10
10
11
void main () {
11
12
late MemoryFileSystem fs;
12
13
14
+ SharedPreferencesLinux .registerWith ();
15
+
13
16
setUp (() {
14
17
fs = MemoryFileSystem .test ();
15
18
});
16
19
17
- tearDown (() {});
18
-
19
20
Future <String > _getFilePath () async {
20
21
final pathProvider = PathProviderLinux ();
21
22
final directory = await pathProvider.getApplicationSupportPath ();
@@ -38,6 +39,11 @@ void main() {
38
39
return prefs;
39
40
}
40
41
42
+ test ('registered instance' , () {
43
+ expect (
44
+ SharedPreferencesStorePlatform .instance, isA <SharedPreferencesLinux >());
45
+ });
46
+
41
47
test ('getAll' , () async {
42
48
await _writeTestFile ('{"key1": "one", "key2": 2}' );
43
49
var prefs = _getPreferences ();
Original file line number Diff line number Diff line change
1
+ ## 2.0.1
2
+
3
+ * Add ` implements ` to the pubspec.
4
+
1
5
## 2.0.0
2
6
3
7
* Migrate to null safety.
Original file line number Diff line number Diff line change 1
1
name : shared_preferences_macos
2
2
description : macOS implementation of the shared_preferences plugin.
3
- version : 2.0.0
3
+ version : 2.0.1
4
4
homepage : https://github.com/flutter/plugins/tree/master/packages/shared_preferences/shared_preferences_macos
5
5
6
6
flutter :
7
7
plugin :
8
+ implements : shared_preferences
8
9
platforms :
9
10
macos :
10
11
pluginClass : SharedPreferencesPlugin
Original file line number Diff line number Diff line change
1
+ ## 2.0.1
2
+
3
+ * Add ` implements ` to pubspec.yaml.
4
+ * Add ` registerWith ` to the Dart main class.
5
+
1
6
## 2.0.0
2
7
3
8
* Migrate to null-safety.
Original file line number Diff line number Diff line change @@ -16,8 +16,15 @@ import 'package:path_provider_windows/path_provider_windows.dart';
16
16
/// This class implements the `package:shared_preferences` functionality for Windows.
17
17
class SharedPreferencesWindows extends SharedPreferencesStorePlatform {
18
18
/// The default instance of [SharedPreferencesWindows] to use.
19
+ /// TODO(egarciad): Remove when the Dart plugin registrant lands on Flutter stable.
20
+ /// https://github.com/flutter/flutter/issues/81421
19
21
static SharedPreferencesWindows instance = SharedPreferencesWindows ();
20
22
23
+ /// Registers the Windows implementation.
24
+ static void registerWith () {
25
+ SharedPreferencesStorePlatform .instance = instance;
26
+ }
27
+
21
28
/// File system used to store to disk. Exposed for testing only.
22
29
@visibleForTesting
23
30
FileSystem fs = LocalFileSystem ();
Original file line number Diff line number Diff line change 1
1
name : shared_preferences_windows
2
2
description : Windows implementation of shared_preferences
3
3
homepage : https://github.com/flutter/plugins/tree/master/packages/shared_preferences/shared_preferences_windows
4
- version : 2.0.0
5
-
4
+ version : 2.0.1
6
5
7
6
flutter :
8
7
plugin :
8
+ implements : shared_preferences
9
9
platforms :
10
10
windows :
11
11
dartPluginClass : SharedPreferencesWindows
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ import 'package:flutter_test/flutter_test.dart';
7
7
import 'package:path/path.dart' as path;
8
8
import 'package:path_provider_platform_interface/path_provider_platform_interface.dart' ;
9
9
import 'package:path_provider_windows/path_provider_windows.dart' ;
10
+ import 'package:shared_preferences_platform_interface/shared_preferences_platform_interface.dart' ;
10
11
import 'package:shared_preferences_windows/shared_preferences_windows.dart' ;
11
12
12
13
void main () {
@@ -18,8 +19,6 @@ void main() {
18
19
pathProvider = FakePathProviderWindows ();
19
20
});
20
21
21
- tearDown (() {});
22
-
23
22
Future <String > _getFilePath () async {
24
23
final directory = await pathProvider.getApplicationSupportPath ();
25
24
return path.join (directory! , 'shared_preferences.json' );
@@ -42,6 +41,12 @@ void main() {
42
41
return prefs;
43
42
}
44
43
44
+ test ('registered instance' , () {
45
+ SharedPreferencesWindows .registerWith ();
46
+ expect (SharedPreferencesStorePlatform .instance,
47
+ isA <SharedPreferencesWindows >());
48
+ });
49
+
45
50
test ('getAll' , () async {
46
51
await _writeTestFile ('{"key1": "one", "key2": 2}' );
47
52
var prefs = _getPreferences ();
You can’t perform that action at this time.
0 commit comments