From 6f76f72722e4437f753e2382234ac621770bce48 Mon Sep 17 00:00:00 2001 From: Gary Roumanis Date: Mon, 25 Jan 2021 17:33:19 -0800 Subject: [PATCH] [cross_file] Use Uri when calling package:http methods (#3462) The next version of package:http expects URIs. See dart-lang/http#507 --- packages/cross_file/CHANGELOG.md | 6 +++++- packages/cross_file/lib/src/types/html.dart | 6 +++--- packages/cross_file/pubspec.yaml | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/packages/cross_file/CHANGELOG.md b/packages/cross_file/CHANGELOG.md index 5ad91979dc89..45f516ad334d 100644 --- a/packages/cross_file/CHANGELOG.md +++ b/packages/cross_file/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.2.1 + +* Prepare for breaking `package:http` change. + ## 0.2.0 * **breaking change** Make sure the `saveTo` method returns a `Future` so it can be awaited and users are sure the file has been written to disk. @@ -12,4 +16,4 @@ ## 0.1.0 -- Initial open-source release \ No newline at end of file +- Initial open-source release diff --git a/packages/cross_file/lib/src/types/html.dart b/packages/cross_file/lib/src/types/html.dart index 646939612d75..527d5e6911f6 100644 --- a/packages/cross_file/lib/src/types/html.dart +++ b/packages/cross_file/lib/src/types/html.dart @@ -3,14 +3,14 @@ // found in the LICENSE file. import 'dart:convert'; +import 'dart:html'; import 'dart:typed_data'; import 'package:http/http.dart' as http show readBytes; import 'package:meta/meta.dart'; -import 'dart:html'; -import '../web_helpers/web_helpers.dart'; import './base.dart'; +import '../web_helpers/web_helpers.dart'; /// A CrossFile that works on web. /// @@ -82,7 +82,7 @@ class XFile extends XFileBase { if (_data != null) { return Future.value(UnmodifiableUint8ListView(_data)); } - return http.readBytes(path); + return http.readBytes(Uri.parse(path)); } @override diff --git a/packages/cross_file/pubspec.yaml b/packages/cross_file/pubspec.yaml index 4c9acf9b008a..2228674baf40 100644 --- a/packages/cross_file/pubspec.yaml +++ b/packages/cross_file/pubspec.yaml @@ -1,7 +1,7 @@ name: cross_file description: An abstraction to allow working with files across multiple platforms. homepage: https://github.com/flutter/plugins/tree/master/packages/cross_file -version: 0.2.0 +version: 0.2.1 dependencies: flutter: