In order to support all of Drifts features, we would nedd a TON of decorators. I thinkg typed_sql get's away with this becuase they have a much smaller feature set
class Group extends Row {
@AutoIncrementPrimaryKey()
int get id;
import 'package:signals/signals.dart'; | |
void main() { | |
final counter = signal(0); | |
effect(() => print(counter.value)); | |
// Logs: 1 | |
counter.value = 1; | |
} |
import "package:riverpod/riverpod.dart"; | |
void main() { | |
// A `ProviderContainer` is the central storage for the state of all providers. | |
final container = ProviderContainer(); | |
// A `StateProvider` is used to expose a simple, mutable piece of state. | |
// In this case, 'counter' holds an integer value, initialized to 0. | |
final counter = StateProvider((ref) => 0); |
import 'package:flutter/material.dart'; | |
void main() { | |
runApp(const MyApp()); | |
} | |
class MyApp extends StatelessWidget { | |
const MyApp({super.key}); | |
// This widget is the root of your application. |
In order to support all of Drifts features, we would nedd a TON of decorators. I thinkg typed_sql get's away with this becuase they have a much smaller feature set
class Group extends Row {
@AutoIncrementPrimaryKey()
int get id;
import "package:rxdart/rxdart.dart"; | |
void main() async { | |
// Emit an incrementing number every 5 seconds | |
final parentStream = Stream.periodic(Duration(seconds: 5), (i) => i); | |
/// Every second, emit an incrementing number which is multipled by the current parentStream | |
final childStream = parentStream.asyncMap((multiplyBy) { | |
return Stream.periodic(Duration(seconds: 1), (i) => i * multiplyBy); | |
}); |
import 'package:flutter/material.dart'; | |
import 'package:flutter/cupertino.dart'; | |
void main() { | |
runApp(const MyApp()); | |
} | |
class MyApp extends StatelessWidget { | |
const MyApp({super.key}); |
class Foo { | |
int bar; | |
Foo(this.bar); | |
} | |
void main() { | |
var data = List.generate(10_000_000, (i) => Foo(i)); | |
// Imutable | |
final t1 = DateTime.now(); | |
data = [for (final i in data) Foo(i.bar + 1)]; |
@Stateful | |
class Counter{ | |
int initialCount; // Public variables are inputs | |
int _count = 0; // Private variables are part of state | |
int? nullableInput = null; // All fields are required unless defaults are specified | |
} |
import 'package:flutter/material.dart'; | |
void main() { | |
runApp(const MyApp()); | |
} | |
class MyApp extends StatelessWidget { | |
const MyApp({super.key}); | |
@override |
import 'package:flutter/material.dart'; | |
void main() { | |
runApp(MyApp()); | |
} | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( |