iamshaunjp / iamshaunjp/flutter-beginners-tutorial
Lesson 26 get does not take url as link
- Dominant language
- No language data
- Stars
- 1.9k
- Forks
- 1.3k
- PR merge metrics
- No merged PRs in 30d
Description
` import 'package:flutter/material.dart';
import 'package:http/http.dart' as http;
import 'dart:convert';
class Loadding extends StatefulWidget {
@override
_LoaddingState createState() => _LoaddingState();
}
class _LoaddingState extends State {
void getTime() async {
http.Response response = await http.get(Uri.parse('https://jsonplaceholder.typicode.com/todos/1'));
Map data = jsonDecode(response.body);
print(data);
print(data['title']);
}
@override
void initState() {
super.initState();
getTime();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("loading"),
centerTitle: true,
),
body: Row(
children: [
ElevatedButton.icon(onPressed: (){
Navigator.pushNamed(context, '/home');
}, icon: Icon(Icons.home), label: Text('Home'))
],
),
);
}
}
`
this will work fine.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.