Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import 'package:flutter/material.dart';
- import 'package:http/http.dart';
- class loading extends StatefulWidget {
- const loading({Key? key}) : super(key: key);
- @override
- _loadingState createState() => _loadingState();
- }
- class _loadingState extends State<loading> {
- void getData() async {
- print('before responce');
- Response responsee = await get(Uri.parse('https://jsonplaceholder.typicode.com/todos/1'));
- print(responsee.body);
- print('after responce');
- }
- int counter = 0;
- @override
- void initState() {
- // TODO: implement initState
- super.initState();
- print('init fun ran');
- getData();
- print('uuu`uuuuuuu`uuu');
- }
- @override
- Widget build(BuildContext context) {
- return Scaffold(
- backgroundColor: Colors.grey,
- appBar: AppBar(
- backgroundColor: Colors.orange,
- title: Text('Loading screen'),
- centerTitle: true,
- elevation: 0,
- ),
- );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement