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
// Assign a value to b if b is null; otherwise, b stays the same | |
b ??= value; |
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
final s = ["d", "e", "f"]; | |
final s2 = ["a", "b", "c", ...s]; | |
print(s2); // [a, b, c, d, e, f] | |
var s; | |
final s2 = ["a", "b", "c", ...?s]; | |
print(s2); // [a, b, c] |
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
val s = arrayOf("d", "e", "f") | |
val s2 = listOf("a", "b", "c", *s) | |
println(s2) // [a, b, c, d, e, f] |
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
final person = Person() | |
..name = "Marcin" | |
..surname = "Oziemski" | |
..age = 99 |
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
val person = Person().apply { | |
name = "Marcin" | |
surname = "Oziemski" | |
age = 99 | |
} |
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
class FabRoute<T> extends MaterialPageRoute<T> { | |
FabRoute(Widget widget, {RouteSettings settings}) | |
: super( | |
builder: (_) => RouteAwareWidget(child: widget), | |
settings: settings); | |
@override | |
Widget buildTransitions(BuildContext context, Animation<double> animation, | |
Animation<double> secondaryAnimation, Widget child) { | |
if (settings.isInitialRoute) return child; |
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
final RouteObserver<PageRoute> routeObserver = RouteObserver<PageRoute>(); | |
class RouteAwareWidget extends StatefulWidget { | |
final Widget child; | |
RouteAwareWidget({this.child}); | |
State<RouteAwareWidget> createState() => RouteAwareWidgetState(child: child); | |
} |
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
floatingActionButton: FloatingActionButton( | |
onPressed: () => StoreProvider.of<AppState>(context) | |
.dispatch(NavigatePushAction(AppRoutes.addGame)), | |
tooltip: 'Add new game', | |
child: Icon(Icons.add), | |
), |