[cross_file] Use Uri when calling package:http methods (#3462)

The next version of package:http expects URIs. See dart-lang/http#507
This commit is contained in:
Gary Roumanis
2021-01-25 17:33:19 -08:00
committed by GitHub
parent b5cdeb6adb
commit 52579675a0
3 changed files with 9 additions and 5 deletions

View File

@ -1,3 +1,7 @@
## 0.2.1
* Prepare for breaking `package:http` change.
## 0.2.0 ## 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. * **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 ## 0.1.0
- Initial open-source release - Initial open-source release

View File

@ -3,14 +3,14 @@
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:convert'; import 'dart:convert';
import 'dart:html';
import 'dart:typed_data'; import 'dart:typed_data';
import 'package:http/http.dart' as http show readBytes; import 'package:http/http.dart' as http show readBytes;
import 'package:meta/meta.dart'; import 'package:meta/meta.dart';
import 'dart:html';
import '../web_helpers/web_helpers.dart';
import './base.dart'; import './base.dart';
import '../web_helpers/web_helpers.dart';
/// A CrossFile that works on web. /// A CrossFile that works on web.
/// ///
@ -82,7 +82,7 @@ class XFile extends XFileBase {
if (_data != null) { if (_data != null) {
return Future.value(UnmodifiableUint8ListView(_data)); return Future.value(UnmodifiableUint8ListView(_data));
} }
return http.readBytes(path); return http.readBytes(Uri.parse(path));
} }
@override @override

View File

@ -1,7 +1,7 @@
name: cross_file name: cross_file
description: An abstraction to allow working with files across multiple platforms. description: An abstraction to allow working with files across multiple platforms.
homepage: https://github.com/flutter/plugins/tree/master/packages/cross_file homepage: https://github.com/flutter/plugins/tree/master/packages/cross_file
version: 0.2.0 version: 0.2.1
dependencies: dependencies:
flutter: flutter: