[path_provider] Migrate examples to null-safety (#3559)
Allows running the examples in strong mode, even though the integration tests can't yet be.
Converts the macOS example to use the platform interface, rather than the app-facing package, to eliminate the circular dependency. Also does some cleanup and simplification of the desktop example pubspecs.
Does not update versions/changelogs since this won't be explicitly published, given that it's example-only.
diff --git a/packages/path_provider/path_provider/example/integration_test/path_provider_test.dart b/packages/path_provider/path_provider/example/integration_test/path_provider_test.dart
index 8eb8520..2b12c82 100644
--- a/packages/path_provider/path_provider/example/integration_test/path_provider_test.dart
+++ b/packages/path_provider/path_provider/example/integration_test/path_provider_test.dart
@@ -2,6 +2,8 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+// @dart=2.9
+
import 'dart:async';
import 'dart:io';
diff --git a/packages/path_provider/path_provider/example/lib/main.dart b/packages/path_provider/path_provider/example/lib/main.dart
index 8e929a6..ddc1f8a 100644
--- a/packages/path_provider/path_provider/example/lib/main.dart
+++ b/packages/path_provider/path_provider/example/lib/main.dart
@@ -28,7 +28,7 @@
}
class MyHomePage extends StatefulWidget {
- MyHomePage({Key key, this.title}) : super(key: key);
+ MyHomePage({Key? key, required this.title}) : super(key: key);
final String title;
@override
@@ -36,13 +36,13 @@
}
class _MyHomePageState extends State<MyHomePage> {
- Future<Directory> _tempDirectory;
- Future<Directory> _appSupportDirectory;
- Future<Directory> _appLibraryDirectory;
- Future<Directory> _appDocumentsDirectory;
- Future<Directory> _externalDocumentsDirectory;
- Future<List<Directory>> _externalStorageDirectories;
- Future<List<Directory>> _externalCacheDirectories;
+ Future<Directory?>? _tempDirectory;
+ Future<Directory?>? _appSupportDirectory;
+ Future<Directory?>? _appLibraryDirectory;
+ Future<Directory?>? _appDocumentsDirectory;
+ Future<Directory?>? _externalDocumentsDirectory;
+ Future<List<Directory>?>? _externalStorageDirectories;
+ Future<List<Directory>?>? _externalCacheDirectories;
void _requestTempDirectory() {
setState(() {
@@ -51,13 +51,13 @@
}
Widget _buildDirectory(
- BuildContext context, AsyncSnapshot<Directory> snapshot) {
+ BuildContext context, AsyncSnapshot<Directory?> snapshot) {
Text text = const Text('');
if (snapshot.connectionState == ConnectionState.done) {
if (snapshot.hasError) {
text = Text('Error: ${snapshot.error}');
} else if (snapshot.hasData) {
- text = Text('path: ${snapshot.data.path}');
+ text = Text('path: ${snapshot.data!.path}');
} else {
text = const Text('path unavailable');
}
@@ -66,14 +66,14 @@
}
Widget _buildDirectories(
- BuildContext context, AsyncSnapshot<List<Directory>> snapshot) {
+ BuildContext context, AsyncSnapshot<List<Directory>?> snapshot) {
Text text = const Text('');
if (snapshot.connectionState == ConnectionState.done) {
if (snapshot.hasError) {
text = Text('Error: ${snapshot.error}');
} else if (snapshot.hasData) {
final String combined =
- snapshot.data.map((Directory d) => d.path).join(', ');
+ snapshot.data!.map((Directory d) => d.path).join(', ');
text = Text('paths: $combined');
} else {
text = const Text('path unavailable');
@@ -134,7 +134,7 @@
onPressed: _requestTempDirectory,
),
),
- FutureBuilder<Directory>(
+ FutureBuilder<Directory?>(
future: _tempDirectory, builder: _buildDirectory),
Padding(
padding: const EdgeInsets.all(16.0),
@@ -143,7 +143,7 @@
onPressed: _requestAppDocumentsDirectory,
),
),
- FutureBuilder<Directory>(
+ FutureBuilder<Directory?>(
future: _appDocumentsDirectory, builder: _buildDirectory),
Padding(
padding: const EdgeInsets.all(16.0),
@@ -152,7 +152,7 @@
onPressed: _requestAppSupportDirectory,
),
),
- FutureBuilder<Directory>(
+ FutureBuilder<Directory?>(
future: _appSupportDirectory, builder: _buildDirectory),
Padding(
padding: const EdgeInsets.all(16.0),
@@ -161,7 +161,7 @@
onPressed: _requestAppLibraryDirectory,
),
),
- FutureBuilder<Directory>(
+ FutureBuilder<Directory?>(
future: _appLibraryDirectory, builder: _buildDirectory),
Padding(
padding: const EdgeInsets.all(16.0),
@@ -172,7 +172,7 @@
Platform.isIOS ? null : _requestExternalStorageDirectory,
),
),
- FutureBuilder<Directory>(
+ FutureBuilder<Directory?>(
future: _externalDocumentsDirectory, builder: _buildDirectory),
Column(children: <Widget>[
Padding(
@@ -190,7 +190,7 @@
),
),
]),
- FutureBuilder<List<Directory>>(
+ FutureBuilder<List<Directory>?>(
future: _externalStorageDirectories,
builder: _buildDirectories),
Column(children: <Widget>[
@@ -204,7 +204,7 @@
),
),
]),
- FutureBuilder<List<Directory>>(
+ FutureBuilder<List<Directory>?>(
future: _externalCacheDirectories, builder: _buildDirectories),
],
),
diff --git a/packages/path_provider/path_provider/example/pubspec.yaml b/packages/path_provider/path_provider/example/pubspec.yaml
index bbb140e..cef0449 100644
--- a/packages/path_provider/path_provider/example/pubspec.yaml
+++ b/packages/path_provider/path_provider/example/pubspec.yaml
@@ -23,5 +23,5 @@
uses-material-design: true
environment:
- sdk: ">=2.1.0 <3.0.0"
+ sdk: ">=2.12.0-0 <3.0.0"
flutter: ">=1.12.13+hotfix.5"
diff --git a/packages/path_provider/path_provider/example/test_driver/integration_test.dart b/packages/path_provider/path_provider/example/test_driver/integration_test.dart
index 7a2c213..ac106b6 100644
--- a/packages/path_provider/path_provider/example/test_driver/integration_test.dart
+++ b/packages/path_provider/path_provider/example/test_driver/integration_test.dart
@@ -2,6 +2,8 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+// @dart=2.9
+
import 'dart:async';
import 'dart:convert';
import 'dart:io';
diff --git a/packages/path_provider/path_provider_linux/example/integration_test/path_provider_test.dart b/packages/path_provider/path_provider_linux/example/integration_test/path_provider_test.dart
index febd521..d08b387 100644
--- a/packages/path_provider/path_provider_linux/example/integration_test/path_provider_test.dart
+++ b/packages/path_provider/path_provider_linux/example/integration_test/path_provider_test.dart
@@ -2,6 +2,8 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+// @dart=2.9
+
import 'dart:io';
import 'package:flutter_test/flutter_test.dart';
import 'package:path_provider_linux/path_provider_linux.dart';
diff --git a/packages/path_provider/path_provider_linux/example/lib/main.dart b/packages/path_provider/path_provider_linux/example/lib/main.dart
index 0693082..6958ed1 100644
--- a/packages/path_provider/path_provider_linux/example/lib/main.dart
+++ b/packages/path_provider/path_provider_linux/example/lib/main.dart
@@ -4,7 +4,7 @@
import 'package:flutter/services.dart';
import 'package:path_provider_linux/path_provider_linux.dart';
-void main() async {
+void main() {
runApp(MyApp());
}
@@ -15,10 +15,10 @@
}
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';
final PathProviderLinux _provider = PathProviderLinux();
@override
@@ -29,10 +29,10 @@
// 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;
// Platform messages may fail, so we use a try/catch PlatformException.
try {
tempDirectory = await _provider.getTemporaryPath();
diff --git a/packages/path_provider/path_provider_linux/example/pubspec.yaml b/packages/path_provider/path_provider_linux/example/pubspec.yaml
index a1a9dde..1fd5571 100644
--- a/packages/path_provider/path_provider_linux/example/pubspec.yaml
+++ b/packages/path_provider/path_provider_linux/example/pubspec.yaml
@@ -3,19 +3,13 @@
publish_to: "none"
environment:
- sdk: ">=2.1.0 <3.0.0"
+ sdk: ">=2.12.0-0 <3.0.0"
+ flutter: ">=1.10.0"
dependencies:
flutter:
sdk: flutter
- path_provider_linux: any
-
- # The following adds the Cupertino Icons font to your application.
- # Use with the CupertinoIcons class for iOS style icons.
- cupertino_icons: ^0.1.3
-
-dependency_overrides:
path_provider_linux:
# When depending on this package from a real application you should use:
# path_provider_linux: ^x.y.z
@@ -32,39 +26,5 @@
integration_test:
path: ../../../integration_test
-# For information on the generic Dart part of this file, see the
-# following page: https://dart.dev/tools/pub/pubspec
-
-# The following section is specific to Flutter.
flutter:
- # The following line ensures that the Material Icons font is
- # included with your application, so that you can use the icons in
- # the material Icons class.
uses-material-design: true
- # To add assets to your application, add an assets section, like this:
- # assets:
- # - images/a_dot_burr.jpeg
- # - images/a_dot_ham.jpeg
- # An image asset can refer to one or more resolution-specific "variants", see
- # https://flutter.dev/assets-and-images/#resolution-aware.
- # For details regarding adding assets from package dependencies, see
- # https://flutter.dev/assets-and-images/#from-packages
- # To add custom fonts to your application, add a fonts section here,
- # in this "flutter" section. Each entry in this list should have a
- # "family" key with the font family name, and a "fonts" key with a
- # list giving the asset and other descriptors for the font. For
- # example:
- # fonts:
- # - family: Schyler
- # fonts:
- # - asset: fonts/Schyler-Regular.ttf
- # - asset: fonts/Schyler-Italic.ttf
- # style: italic
- # - family: Trajan Pro
- # fonts:
- # - asset: fonts/TrajanPro.ttf
- # - asset: fonts/TrajanPro_Bold.ttf
- # weight: 700
- #
- # For details regarding fonts from package dependencies,
- # see https://flutter.dev/custom-fonts/#from-packages
diff --git a/packages/path_provider/path_provider_linux/example/test/widget_test.dart b/packages/path_provider/path_provider_linux/example/test/widget_test.dart
index 8ebda3b..086b6d6 100644
--- a/packages/path_provider/path_provider_linux/example/test/widget_test.dart
+++ b/packages/path_provider/path_provider_linux/example/test/widget_test.dart
@@ -30,7 +30,7 @@
find.byWidgetPredicate(
(Widget widget) =>
widget is Text &&
- widget.data.startsWith('Temp Directory: /tmp'),
+ widget.data!.startsWith('Temp Directory: /tmp'),
),
findsOneWidget,
);
@@ -48,7 +48,7 @@
find.byWidgetPredicate(
(Widget widget) =>
widget is Text &&
- widget.data.startsWith('Documents Directory: /'),
+ widget.data!.startsWith('Documents Directory: /'),
),
findsOneWidget,
);
@@ -66,7 +66,7 @@
find.byWidgetPredicate(
(Widget widget) =>
widget is Text &&
- widget.data.startsWith('Downloads Directory: /'),
+ widget.data!.startsWith('Downloads Directory: /'),
),
findsOneWidget,
);
@@ -85,7 +85,7 @@
find.byWidgetPredicate(
(Widget widget) =>
widget is Text &&
- widget.data.startsWith('Application Support Directory: /'),
+ widget.data!.startsWith('Application Support Directory: /'),
),
findsOneWidget,
);
diff --git a/packages/path_provider/path_provider_linux/example/test_driver/integration_test.dart b/packages/path_provider/path_provider_linux/example/test_driver/integration_test.dart
index 7a2c213..ac106b6 100644
--- a/packages/path_provider/path_provider_linux/example/test_driver/integration_test.dart
+++ b/packages/path_provider/path_provider_linux/example/test_driver/integration_test.dart
@@ -2,6 +2,8 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+// @dart=2.9
+
import 'dart:async';
import 'dart:convert';
import 'dart:io';
diff --git a/packages/path_provider/path_provider_macos/example/integration_test/path_provider_test.dart b/packages/path_provider/path_provider_macos/example/integration_test/path_provider_test.dart
index 58a4d18..1bb0790 100644
--- a/packages/path_provider/path_provider_macos/example/integration_test/path_provider_test.dart
+++ b/packages/path_provider/path_provider_macos/example/integration_test/path_provider_test.dart
@@ -2,42 +2,56 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+// @dart=2.9
+
import 'dart:io';
import 'package:flutter_test/flutter_test.dart';
-import 'package:path_provider/path_provider.dart';
+import 'package:path_provider_platform_interface/path_provider_platform_interface.dart';
import 'package:integration_test/integration_test.dart';
void main() {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
testWidgets('getTemporaryDirectory', (WidgetTester tester) async {
- final Directory result = await getTemporaryDirectory();
+ final PathProviderPlatform provider = PathProviderPlatform.instance;
+ final String result = await provider.getTemporaryPath();
_verifySampleFile(result, 'temporaryDirectory');
});
testWidgets('getApplicationDocumentsDirectory', (WidgetTester tester) async {
- final Directory result = await getApplicationDocumentsDirectory();
+ final PathProviderPlatform provider = PathProviderPlatform.instance;
+ final String result = await provider.getApplicationDocumentsPath();
_verifySampleFile(result, 'applicationDocuments');
});
testWidgets('getApplicationSupportDirectory', (WidgetTester tester) async {
- final Directory result = await getApplicationSupportDirectory();
+ final PathProviderPlatform provider = PathProviderPlatform.instance;
+ final String result = await provider.getApplicationSupportPath();
_verifySampleFile(result, 'applicationSupport');
});
testWidgets('getLibraryDirectory', (WidgetTester tester) async {
- if (!Platform.isMacOS) {
- return;
- }
- final Directory result = await getLibraryDirectory();
+ final PathProviderPlatform provider = PathProviderPlatform.instance;
+ final String result = await provider.getLibraryPath();
_verifySampleFile(result, 'library');
});
+
+ testWidgets('getDownloadsDirectory', (WidgetTester tester) async {
+ final PathProviderPlatform provider = PathProviderPlatform.instance;
+ final String result = await provider.getDownloadsPath();
+ // _verifySampleFile causes hangs in driver for some reason, so just
+ // validate that a non-empty path was returned.
+ expect(result, isNotEmpty);
+ });
}
-/// Verify a file called [name] in [directory] by recreating it with test
+/// Verify a file called [name] in [directoryPath] by recreating it with test
/// contents when necessary.
-void _verifySampleFile(Directory directory, String name) {
- final File file = File('${directory.path}/$name');
+///
+/// If [createDirectory] is true, the directory will be created if missing.
+void _verifySampleFile(String directoryPath, String name) {
+ final Directory directory = Directory(directoryPath);
+ final File file = File('${directory.path}${Platform.pathSeparator}$name');
if (file.existsSync()) {
file.deleteSync();
diff --git a/packages/path_provider/path_provider_macos/example/lib/main.dart b/packages/path_provider/path_provider_macos/example/lib/main.dart
index 1c1c90b..f19807f 100644
--- a/packages/path_provider/path_provider_macos/example/lib/main.dart
+++ b/packages/path_provider/path_provider_macos/example/lib/main.dart
@@ -5,143 +5,87 @@
// ignore_for_file: public_member_api_docs
import 'dart:async';
-import 'dart:io' show Directory;
import 'package:flutter/material.dart';
-import 'package:path_provider/path_provider.dart';
+import 'package:path_provider_platform_interface/path_provider_platform_interface.dart';
void main() {
runApp(MyApp());
}
-class MyApp extends StatelessWidget {
+/// Sample app
+class MyApp extends StatefulWidget {
+ @override
+ _MyAppState createState() => _MyAppState();
+}
+
+class _MyAppState extends State<MyApp> {
+ String? _tempDirectory = 'Unknown';
+ String? _downloadsDirectory = 'Unknown';
+ String? _appSupportDirectory = 'Unknown';
+ String? _documentsDirectory = 'Unknown';
+
+ @override
+ void initState() {
+ super.initState();
+ initDirectories();
+ }
+
+ // Platform messages are asynchronous, so we initialize in an async method.
+ Future<void> initDirectories() async {
+ String? tempDirectory;
+ String? downloadsDirectory;
+ String? appSupportDirectory;
+ String? documentsDirectory;
+ final PathProviderPlatform provider = PathProviderPlatform.instance;
+
+ try {
+ tempDirectory = await provider.getTemporaryPath();
+ } catch (exception) {
+ tempDirectory = 'Failed to get temp directory: $exception';
+ }
+ try {
+ downloadsDirectory = await provider.getDownloadsPath();
+ } catch (exception) {
+ downloadsDirectory = 'Failed to get downloads directory: $exception';
+ }
+
+ try {
+ documentsDirectory = await provider.getApplicationDocumentsPath();
+ } catch (exception) {
+ documentsDirectory = 'Failed to get documents directory: $exception';
+ }
+
+ try {
+ appSupportDirectory = await provider.getApplicationSupportPath();
+ } catch (exception) {
+ appSupportDirectory = 'Failed to get app support directory: $exception';
+ }
+
+ setState(() {
+ _tempDirectory = tempDirectory;
+ _downloadsDirectory = downloadsDirectory;
+ _appSupportDirectory = appSupportDirectory;
+ _documentsDirectory = documentsDirectory;
+ });
+ }
+
@override
Widget build(BuildContext context) {
return MaterialApp(
- title: 'Path Provider',
- theme: ThemeData(
- primarySwatch: Colors.blue,
- ),
- home: MyHomePage(title: 'Path Provider'),
- );
- }
-}
-
-class MyHomePage extends StatefulWidget {
- MyHomePage({Key key, this.title}) : super(key: key);
- final String title;
-
- @override
- _MyHomePageState createState() => _MyHomePageState();
-}
-
-class _MyHomePageState extends State<MyHomePage> {
- Future<Directory> _tempDirectory;
- Future<Directory> _appSupportDirectory;
- Future<Directory> _appDocumentsDirectory;
- Future<Directory> _appLibraryDirectory;
- Future<Directory> _downloadsDirectory;
-
- void _requestTempDirectory() {
- setState(() {
- _tempDirectory = getTemporaryDirectory();
- });
- }
-
- Widget _buildDirectory(
- BuildContext context, AsyncSnapshot<Directory> snapshot) {
- Text text = const Text('');
- if (snapshot.connectionState == ConnectionState.done) {
- if (snapshot.hasError) {
- text = Text('Error: ${snapshot.error}');
- } else if (snapshot.hasData) {
- text = Text('path: ${snapshot.data.path}');
- } else {
- text = const Text('path unavailable');
- }
- }
- return Padding(padding: const EdgeInsets.all(16.0), child: text);
- }
-
- void _requestAppDocumentsDirectory() {
- setState(() {
- _appDocumentsDirectory = getApplicationDocumentsDirectory();
- });
- }
-
- void _requestAppSupportDirectory() {
- setState(() {
- _appSupportDirectory = getApplicationSupportDirectory();
- });
- }
-
- void _requestAppLibraryDirectory() {
- setState(() {
- _appLibraryDirectory = getLibraryDirectory();
- });
- }
-
- void _requestDownloadsDirectory() {
- setState(() {
- _downloadsDirectory = getDownloadsDirectory();
- });
- }
-
- @override
- Widget build(BuildContext context) {
- return Scaffold(
- appBar: AppBar(
- title: Text(widget.title),
- ),
- body: Center(
- child: ListView(
- children: <Widget>[
- Padding(
- padding: const EdgeInsets.all(16.0),
- child: ElevatedButton(
- child: const Text('Get Temporary Directory'),
- onPressed: _requestTempDirectory,
- ),
- ),
- FutureBuilder<Directory>(
- future: _tempDirectory, builder: _buildDirectory),
- Padding(
- padding: const EdgeInsets.all(16.0),
- child: ElevatedButton(
- child: const Text('Get Application Documents Directory'),
- onPressed: _requestAppDocumentsDirectory,
- ),
- ),
- FutureBuilder<Directory>(
- future: _appDocumentsDirectory, builder: _buildDirectory),
- Padding(
- padding: const EdgeInsets.all(16.0),
- child: ElevatedButton(
- child: const Text('Get Application Support Directory'),
- onPressed: _requestAppSupportDirectory,
- ),
- ),
- FutureBuilder<Directory>(
- future: _appSupportDirectory, builder: _buildDirectory),
- Padding(
- padding: const EdgeInsets.all(16.0),
- child: ElevatedButton(
- child: const Text('Get Application Library Directory'),
- onPressed: _requestAppLibraryDirectory,
- ),
- ),
- FutureBuilder<Directory>(
- future: _appLibraryDirectory, builder: _buildDirectory),
- Padding(
- padding: const EdgeInsets.all(16.0),
- child: ElevatedButton(
- child: const Text('Get Downlads Directory'),
- onPressed: _requestDownloadsDirectory,
- ),
- ),
- FutureBuilder<Directory>(
- future: _downloadsDirectory, builder: _buildDirectory),
- ],
+ home: Scaffold(
+ appBar: AppBar(
+ title: const Text('Path Provider example app'),
+ ),
+ body: Center(
+ child: Column(
+ children: [
+ Text('Temp Directory: $_tempDirectory\n'),
+ Text('Documents Directory: $_documentsDirectory\n'),
+ Text('Downloads Directory: $_downloadsDirectory\n'),
+ Text('Application Support Directory: $_appSupportDirectory\n'),
+ ],
+ ),
),
),
);
diff --git a/packages/path_provider/path_provider_macos/example/macos/Runner.xcodeproj/project.pbxproj b/packages/path_provider/path_provider_macos/example/macos/Runner.xcodeproj/project.pbxproj
index 1e39683..51bfc33 100644
--- a/packages/path_provider/path_provider_macos/example/macos/Runner.xcodeproj/project.pbxproj
+++ b/packages/path_provider/path_provider_macos/example/macos/Runner.xcodeproj/project.pbxproj
@@ -27,10 +27,6 @@
33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F22044A3C60003C045 /* Assets.xcassets */; };
33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F42044A3C60003C045 /* MainMenu.xib */; };
33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */; };
- 33D1A10422148B71006C7A3E /* FlutterMacOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 33D1A10322148B71006C7A3E /* FlutterMacOS.framework */; };
- 33D1A10522148B93006C7A3E /* FlutterMacOS.framework in Bundle Framework */ = {isa = PBXBuildFile; fileRef = 33D1A10322148B71006C7A3E /* FlutterMacOS.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
- D73912F022F37F9E000D13A0 /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D73912EF22F37F9E000D13A0 /* App.framework */; };
- D73912F222F3801D000D13A0 /* App.framework in Bundle Framework */ = {isa = PBXBuildFile; fileRef = D73912EF22F37F9E000D13A0 /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
@@ -50,8 +46,6 @@
dstPath = "";
dstSubfolderSpec = 10;
files = (
- D73912F222F3801D000D13A0 /* App.framework in Bundle Framework */,
- 33D1A10522148B93006C7A3E /* FlutterMacOS.framework in Bundle Framework */,
);
name = "Bundle Framework";
runOnlyForDeploymentPostprocessing = 0;
@@ -72,14 +66,12 @@
33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Flutter-Debug.xcconfig"; sourceTree = "<group>"; };
33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Flutter-Release.xcconfig"; sourceTree = "<group>"; };
33CEB47722A0578A004F2AC0 /* Flutter-Generated.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = "Flutter-Generated.xcconfig"; path = "ephemeral/Flutter-Generated.xcconfig"; sourceTree = "<group>"; };
- 33D1A10322148B71006C7A3E /* FlutterMacOS.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = FlutterMacOS.framework; path = Flutter/ephemeral/FlutterMacOS.framework; sourceTree = SOURCE_ROOT; };
33E51913231747F40026EE4D /* DebugProfile.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = DebugProfile.entitlements; sourceTree = "<group>"; };
33E51914231749380026EE4D /* Release.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = Release.entitlements; sourceTree = "<group>"; };
33E5194F232828860026EE4D /* AppInfo.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = AppInfo.xcconfig; sourceTree = "<group>"; };
46139048DB9F59D473B61B5E /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = "<group>"; };
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = "<group>"; };
- D73912EF22F37F9E000D13A0 /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/ephemeral/App.framework; sourceTree = SOURCE_ROOT; };
F4586DA69948E3A954A2FC9C /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; };
/* End PBXFileReference section */
@@ -88,8 +80,6 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
- D73912F022F37F9E000D13A0 /* App.framework in Frameworks */,
- 33D1A10422148B71006C7A3E /* FlutterMacOS.framework in Frameworks */,
23F6FAA3AF82DFCF2B7DD79A /* Pods_Runner.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
@@ -156,8 +146,6 @@
33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */,
33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */,
33CEB47722A0578A004F2AC0 /* Flutter-Generated.xcconfig */,
- D73912EF22F37F9E000D13A0 /* App.framework */,
- 33D1A10322148B71006C7A3E /* FlutterMacOS.framework */,
);
path = Flutter;
sourceTree = "<group>";
@@ -281,7 +269,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
- shellScript = "echo \"$PRODUCT_NAME.app\" > \"$PROJECT_DIR\"/Flutter/ephemeral/.app_filename\n";
+ shellScript = "echo \"$PRODUCT_NAME.app\" > \"$PROJECT_DIR\"/Flutter/ephemeral/.app_filename && \"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh embed\n";
};
33CC111E2044C6BF0003C045 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
@@ -308,10 +296,13 @@
buildActionMask = 2147483647;
files = (
);
- inputFileListPaths = (
+ inputPaths = (
+ "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh",
+ "${BUILT_PRODUCTS_DIR}/path_provider_macos/path_provider_macos.framework",
);
name = "[CP] Embed Pods Frameworks";
- outputFileListPaths = (
+ outputPaths = (
+ "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/path_provider_macos.framework",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
diff --git a/packages/path_provider/path_provider_macos/example/macos/Runner/DebugProfile.entitlements b/packages/path_provider/path_provider_macos/example/macos/Runner/DebugProfile.entitlements
index dddb8a3..8139952 100644
--- a/packages/path_provider/path_provider_macos/example/macos/Runner/DebugProfile.entitlements
+++ b/packages/path_provider/path_provider_macos/example/macos/Runner/DebugProfile.entitlements
@@ -8,5 +8,7 @@
<true/>
<key>com.apple.security.network.server</key>
<true/>
+ <key>com.apple.security.files.downloads.read-write</key>
+ <true/>
</dict>
</plist>
diff --git a/packages/path_provider/path_provider_macos/example/macos/Runner/Release.entitlements b/packages/path_provider/path_provider_macos/example/macos/Runner/Release.entitlements
index 852fa1a..2f9659c 100644
--- a/packages/path_provider/path_provider_macos/example/macos/Runner/Release.entitlements
+++ b/packages/path_provider/path_provider_macos/example/macos/Runner/Release.entitlements
@@ -4,5 +4,7 @@
<dict>
<key>com.apple.security.app-sandbox</key>
<true/>
+ <key>com.apple.security.files.downloads.read-write</key>
+ <true/>
</dict>
</plist>
diff --git a/packages/path_provider/path_provider_macos/example/pubspec.yaml b/packages/path_provider/path_provider_macos/example/pubspec.yaml
index cb904fa..4954593 100644
--- a/packages/path_provider/path_provider_macos/example/pubspec.yaml
+++ b/packages/path_provider/path_provider_macos/example/pubspec.yaml
@@ -4,11 +4,6 @@
dependencies:
flutter:
sdk: flutter
- path_provider: ^1.6.14
-
-# path_provider_macos is endorsed, so we need to add it to dependency_overrides
-# to depend on it from path:
-dependency_overrides:
path_provider_macos:
# When depending on this package from a real application you should use:
# path_provider_macos: ^x.y.z
@@ -16,6 +11,7 @@
# The example app is bundled with the plugin so we use a path dependency on
# the parent directory to use the current plugin's version.
path: ../
+ path_provider_platform_interface: 2.0.0-nullsafety
dev_dependencies:
integration_test:
@@ -28,5 +24,5 @@
uses-material-design: true
environment:
- sdk: ">=2.1.0 <3.0.0"
+ sdk: ">=2.12.0-0 <3.0.0"
flutter: ">=1.10.0"
diff --git a/packages/path_provider/path_provider_macos/example/test_driver/integration_test.dart b/packages/path_provider/path_provider_macos/example/test_driver/integration_test.dart
index 7a2c213..ac106b6 100644
--- a/packages/path_provider/path_provider_macos/example/test_driver/integration_test.dart
+++ b/packages/path_provider/path_provider_macos/example/test_driver/integration_test.dart
@@ -2,6 +2,8 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+// @dart=2.9
+
import 'dart:async';
import 'dart:convert';
import 'dart:io';
diff --git a/packages/path_provider/path_provider_windows/example/integration_test/path_provider_test.dart b/packages/path_provider/path_provider_windows/example/integration_test/path_provider_test.dart
index ee94276..0953fc1 100644
--- a/packages/path_provider/path_provider_windows/example/integration_test/path_provider_test.dart
+++ b/packages/path_provider/path_provider_windows/example/integration_test/path_provider_test.dart
@@ -2,13 +2,15 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+// @dart=2.9
+
import 'dart:io';
import 'package:flutter_test/flutter_test.dart';
import 'package:path_provider_windows/path_provider_windows.dart';
-import 'package:e2e/e2e.dart';
+import 'package:integration_test/integration_test.dart';
void main() {
- E2EWidgetsFlutterBinding.ensureInitialized();
+ IntegrationTestWidgetsFlutterBinding.ensureInitialized();
testWidgets('getTemporaryDirectory', (WidgetTester tester) async {
final PathProviderWindows provider = PathProviderWindows();
diff --git a/packages/path_provider/path_provider_windows/example/lib/main.dart b/packages/path_provider/path_provider_windows/example/lib/main.dart
index 4fbb1de..964ef3d 100644
--- a/packages/path_provider/path_provider_windows/example/lib/main.dart
+++ b/packages/path_provider/path_provider_windows/example/lib/main.dart
@@ -9,7 +9,7 @@
import 'package:flutter/material.dart';
import 'package:path_provider_windows/path_provider_windows.dart';
-void main() async {
+void main() {
runApp(MyApp());
}
@@ -20,10 +20,10 @@
}
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() {
@@ -33,10 +33,10 @@
// 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 {
diff --git a/packages/path_provider/path_provider_windows/example/pubspec.yaml b/packages/path_provider/path_provider_windows/example/pubspec.yaml
index 7a34d90..5704502 100644
--- a/packages/path_provider/path_provider_windows/example/pubspec.yaml
+++ b/packages/path_provider/path_provider_windows/example/pubspec.yaml
@@ -4,9 +4,6 @@
dependencies:
flutter:
sdk: flutter
- path_provider_windows: any
-
-dependency_overrides:
path_provider_windows:
# When depending on this package from a real application you should use:
# path_provider_windows: ^x.y.z
@@ -16,7 +13,8 @@
path: ../
dev_dependencies:
- e2e: ^0.2.1
+ integration_test:
+ path: ../../../integration_test
flutter_driver:
sdk: flutter
pedantic: ^1.8.0
@@ -25,5 +23,5 @@
uses-material-design: true
environment:
- sdk: ">=2.1.0 <3.0.0"
+ sdk: ">=2.12.0-0 <3.0.0"
flutter: ">=1.12.13+hotfix.4"
diff --git a/packages/path_provider/path_provider_windows/example/test_driver/integration_test.dart b/packages/path_provider/path_provider_windows/example/test_driver/integration_test.dart
index f3aa9e2..ac106b6 100644
--- a/packages/path_provider/path_provider_windows/example/test_driver/integration_test.dart
+++ b/packages/path_provider/path_provider_windows/example/test_driver/integration_test.dart
@@ -2,14 +2,18 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+// @dart=2.9
+
import 'dart:async';
+import 'dart:convert';
import 'dart:io';
import 'package:flutter_driver/flutter_driver.dart';
Future<void> main() async {
final FlutterDriver driver = await FlutterDriver.connect();
- final String result =
+ final String data =
await driver.requestData(null, timeout: const Duration(minutes: 1));
await driver.close();
- exit(result == 'pass' ? 0 : 1);
+ final Map<String, dynamic> result = jsonDecode(data);
+ exit(result['result'] == 'true' ? 0 : 1);
}
diff --git a/packages/path_provider/path_provider_windows/pubspec.yaml b/packages/path_provider/path_provider_windows/pubspec.yaml
index 384eae9..eb7d108 100644
--- a/packages/path_provider/path_provider_windows/pubspec.yaml
+++ b/packages/path_provider/path_provider_windows/pubspec.yaml
@@ -25,5 +25,5 @@
pedantic: ^1.10.0-nullsafety.3
environment:
- sdk: '>=2.12.0-259.8.beta <3.0.0'
+ sdk: ">=2.12.0-0 <3.0.0"
flutter: ">=1.12.13+hotfix.4"