Skip to content

Instantly share code, notes, and snippets.

@rodydavis
Created January 29, 2025 19:44
Show Gist options
  • Save rodydavis/f5a9c7151bf88b187d748f09394f284a to your computer and use it in GitHub Desktop.
Save rodydavis/f5a9c7151bf88b187d748f09394f284a to your computer and use it in GitHub Desktop.
import 'package:flutter/material.dart';
import 'package:signals/signals_flutter.dart';
final debugShowCheckedModeBanner = signal(false);
final app = computed<Widget>(() {
return MaterialApp(
debugShowCheckedModeBanner: debugShowCheckedModeBanner(),
home: home(),
);
});
final title = signal('My App');
final count = signal(0);
final countStr = computed(() => 'Count: $count');
final home = computed<Widget>(() {
return Scaffold(
appBar: AppBar(
title: Text(title()),
),
body: Center(
child: TextButton(
onPressed: () => count.value++,
child: Text(countStr()),
),
),
);
});
void main() {
runApp(Watch((context) => app()));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment