Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Flutter - Minimal Stateful App
import 'package:flutter/material.dart';
main() => runApp(MinimalStatefulApp());
class MinimalStatefulApp extends StatefulWidget {
_MinimalState createState() => _MinimalState();
class _MinimalState extends State<MinimalStatefulApp> {
int _counter = 0;
Widget build(BuildContext context) {
return GestureDetector(
onDoubleTap: () => setState(() => _counter++),
child: Center(
child: Text(
'Counter: $_counter',
textDirection: TextDirection.ltr,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment