Advertisement
Hitesh_jadhav

not showing http response (flutter)

Jan 26th, 2022
21
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. import 'package:flutter/material.dart';
  2. import 'package:http/http.dart';
  3. class loading extends StatefulWidget {
  4. const loading({Key? key}) : super(key: key);
  5.  
  6. @override
  7. _loadingState createState() => _loadingState();
  8. }
  9.  
  10. class _loadingState extends State<loading> {
  11. void getData() async {
  12. print('before responce');
  13. Response responsee = await get(Uri.parse('https://jsonplaceholder.typicode.com/todos/1'));
  14. print(responsee.body);
  15. print('after responce');
  16. }
  17.  
  18. int counter = 0;
  19.  
  20. @override
  21. void initState() {
  22. // TODO: implement initState
  23. super.initState();
  24. print('init fun ran');
  25. getData();
  26. print('uuu`uuuuuuu`uuu');
  27. }
  28.  
  29. @override
  30. Widget build(BuildContext context) {
  31. return Scaffold(
  32. backgroundColor: Colors.grey,
  33. appBar: AppBar(
  34. backgroundColor: Colors.orange,
  35. title: Text('Loading screen'),
  36. centerTitle: true,
  37. elevation: 0,
  38. ),
  39. );
  40. }
  41. }
  42.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement