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: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( |
import 'package:flutter/material.dart'; | |
extension When<T> on AsyncSnapshot<T> { | |
R when<R>({ | |
required R Function(T data) data, | |
required R Function(Object error, StackTrace stackTrace) error, | |
required R Function() loading, | |
}) { | |
switch (connectionState) { | |
case ConnectionState.none: |
import 'package:flutter/material.dart'; | |
const Color darkBlue = Color.fromARGB(255, 18, 32, 47); | |
void main() { | |
runApp(MyApp()); | |
} | |
class MyApp extends StatelessWidget { | |
@override |