Skip to content

Instantly share code, notes, and snippets.

Avatar

Tobias h4p

  • Aumühle
View GitHub Profile
@h4p
h4p / bareBones.dart
Created Sep 16, 2020
Flutter - Bare Bones App
View bareBones.dart
import 'package:flutter/widgets.dart';
main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(context) => Center(
child: Text('Hello Flutter!', textDirection: TextDirection.ltr)
);
}
@h4p
h4p / minimal_material.dart
Created Sep 16, 2020
Flutter - Minimal Material App
View minimal_material.dart
// lib/main.dart
import 'package:flutter/material.dart';
main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(context) {
return MaterialApp(
@h4p
h4p / minimal_stateful.dart
Created Sep 16, 2020
Flutter - Minimal Stateful App
View minimal_stateful.dart
import 'package:flutter/material.dart';
main() => runApp(MinimalStatefulApp());
class MinimalStatefulApp extends StatefulWidget {
@override
_MinimalState createState() => _MinimalState();
}
class _MinimalState extends State<MinimalStatefulApp> {
@h4p
h4p / flutter_async.dart
Created Sep 16, 2020
Flutter - Async Method Call
View flutter_async.dart
import 'package:flutter/material.dart';
void main() => runApp(MaterialApp(home: Scaffold(body: Center(child: MyWidget()))));
Future<String> callAsyncFetch() => Future.delayed(Duration(seconds: 2), () => "hi");
class MyWidget extends StatelessWidget {
@override
Widget build(context) {
return FutureBuilder<String>(