Last active
November 22, 2021 07:17
-
-
Save gabrielgatu/0095c595b0decf892b3c2aa11f9706c5 to your computer and use it in GitHub Desktop.
Flutter2Start - HTTP #flutter2start
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ignore_for_file: use_key_in_widget_constructors, prefer_const_constructors, prefer_const_literals_to_create_immutables | |
import 'package:flutter/material.dart'; | |
import 'package:http/http.dart' as http; | |
void main() { | |
runApp(App()); | |
} | |
class App extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
home: HomePage(), | |
); | |
} | |
} | |
class HomePage extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
http.get(Uri.parse("https://edu.fudeo.it/")).then((response) { | |
if (response.statusCode == 200) { | |
print("OK"); | |
} else { | |
print("ERROR"); | |
} | |
}); | |
return Scaffold( | |
appBar: AppBar( | |
title: Text("Flutter2Start"), | |
centerTitle: true, | |
), | |
body: Center(child: body()), | |
); | |
} | |
Widget body() => Text("Empty."); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment