Skip to content

Commit 27850f6

Browse files
committed
fix error due to breaking change in http 0.13
dart-lang/http#538 The breaking change of the http makes all the request originally in string, now must be Uri. Using Uri.parse to refactor all the place using http package method
1 parent 5a95da6 commit 27850f6

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

lib/fetch_data/main_fetch_data.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ class _MainFetchDataState extends State<MainFetchData> {
1717
setState(() {
1818
isLoading = true;
1919
});
20-
final response =
21-
await http.get("https://jsonplaceholder.typicode.com/photos");
20+
final response = await http
21+
.get(Uri.parse("https://jsonplaceholder.typicode.com/photos"));
2222
if (response.statusCode == 200) {
2323
list = (json.decode(response.body) as List)
2424
.map((data) => new Photo.fromJson(data))

lib/persistent_tabbar/page1.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ class _Page1State extends State<Page1> {
1212
var list = List();
1313

1414
_loadList() async {
15-
final response =
16-
await http.get("https://jsonplaceholder.typicode.com/posts/");
15+
final response = await http
16+
.get(Uri.parse("https://jsonplaceholder.typicode.com/posts/"));
1717
if (response.statusCode == 200) {
1818
await Future.delayed(const Duration(seconds: 1));
1919
if (mounted) {

lib/persistent_tabbar/page2.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ class _Page2State extends State<Page2>
1313
var list = List();
1414

1515
_loadList() async {
16-
final response =
17-
await http.get("https://jsonplaceholder.typicode.com/photos/");
16+
final response = await http
17+
.get(Uri.parse("https://jsonplaceholder.typicode.com/photos/"));
1818
if (response.statusCode == 200) {
1919
await Future.delayed(const Duration(seconds: 1));
2020
if (mounted) {

0 commit comments

Comments
 (0)