Skip to content

Instantly share code, notes, and snippets.

@gabrielgatu
Last active November 22, 2021 07:17
Show Gist options
  • Save gabrielgatu/0095c595b0decf892b3c2aa11f9706c5 to your computer and use it in GitHub Desktop.
Save gabrielgatu/0095c595b0decf892b3c2aa11f9706c5 to your computer and use it in GitHub Desktop.
Flutter2Start - HTTP #flutter2start
// 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