This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'dart:async'; | |
| typedef Nullary<T> = T Function(); | |
| typedef NullaryAsync<T> = Nullary<Future<T>>; | |
| typedef NullaryFutureOr<T> = Nullary<FutureOr<T>>; | |
| typedef Unary<T, S> = T Function(S); | |
| typedef UnaryAsync<T, S> = Unary<Future<T>, S>; | |
| typedef UnaryFutureOr<T, S> = Unary<FutureOr<T>, S>; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'package:flutter/material.dart'; | |
| void main() => runApp(const MaterialApp(home: MyHomePage())); | |
| class MyHomePage extends StatefulWidget { | |
| const MyHomePage({super.key}); | |
| @override | |
| State<MyHomePage> createState() => _MyHomePageState(); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'package:flutter/material.dart'; | |
| void main() => runApp(const MaterialApp(home: MyHomePage())); | |
| class MyHomePage extends StatefulWidget { | |
| const MyHomePage({super.key}); | |
| @override | |
| State<MyHomePage> createState() => _MyHomePageState(); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'package:flutter/material.dart'; | |
| void main() => runApp(const MaterialApp(home: MyHomePage())); | |
| class MyHomePage extends StatefulWidget { | |
| const MyHomePage({super.key}); | |
| @override | |
| State<MyHomePage> createState() => _MyHomePageState(); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'package:flutter/material.dart'; | |
| class ButtonStyleOverlay { | |
| const ButtonStyleOverlay(); | |
| Color call(Set<MaterialState> states) { | |
| if (states.contains(MaterialState.focused)) { | |
| return Colors.white; | |
| } | |
| if (states.contains(MaterialState.hovered)) { | |
| return Colors.orange; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'package:flutter/material.dart'; | |
| import 'package:flutter/services.dart'; | |
| void main() => runApp(const MaterialApp(home: HomePage())); | |
| extension HumanReadableRawKeyEventX on RawKeyEvent { | |
| String get details => [ | |
| this is RawKeyDownEvent ? 'down' : 'up', | |
| '$logicalKey', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'package:flutter/material.dart'; | |
| import 'package:flutter_hooks/flutter_hooks.dart'; | |
| void main() => runApp(const Application()); | |
| class Application extends StatelessWidget { | |
| const Application({super.key}); | |
| @override | |
| Widget build(context) => const MaterialApp(home: HomePage()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'package:flutter/material.dart'; | |
| import 'package:go_router/go_router.dart'; | |
| abstract class Routes { | |
| static const splash = '/'; | |
| static const home = '/home'; | |
| } | |
| void main() => runApp(const MyApp()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| List<int> integersUntil(int limit) => [for (var i = 0; i < limit; i++) i]; | |
| class Foo { | |
| final List<int> bar; | |
| final List<int> baz; | |
| const Foo(this.bar, this.baz); | |
| @override | |
| bool operator ==(Object other) => other is Foo && other.hashCode == hashCode; | |
| @override |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| List<int> intUntil(int n) => [for (var i = 0; i < n; ++i) i]; | |
| extension PaginateX<T> on List<T> { | |
| Iterable<Iterable<T>> paginateBy(int n) sync* { | |
| final floor = (length / n).floor(); | |
| for (var i = 0; i < floor; ++i) { | |
| yield getRange(i * n, (i + 1) * n); | |
| } |