Sergio Molchanovsky
Sergio Molchanovsky
> Does this solves your problem? > > ```dart > var x = switch ((a, b)) { > (> 0, _) => 1, > (_, < 10) => 2, >...
At least, there are if-expressions in Rust, Python, Kotlin and Swift, along with switch/match expressions: https://doc.rust-lang.org/reference/expressions/if-expr.html https://www.hackingwithswift.com/swift/5.9/if-switch-expressions https://kotlinlang.org/docs/control-flow.html https://note.nkmk.me/en/python-if-conditional-expressions/
```dart var x = (a > 0) ? 1 : (b < 10) ? 2 : 3; ``` This is a so-called "ternary hell", rather an example of "how you...
> @subzero911 Do you think `var x = if (a > 0) 1 else if (b < 10) 2 else 3;` is any better? Maybe we can solve the "ternary...
First of all, it's strange that we can do call GetIt.instance(). Is it a callable class? I personally never did it. Do we actually need this assertion?
> I always recommend passing the Generic type explicitly because then there is no room for doubt But writing `GetIt.I.registerSingleton(MyControllerWithVeryLongName())` every time is not concise.
+1 for onEnter / onExit methods in GoRoute. It will allow us to register dependencies right inside GoRoutes (and generally run any custom code) ```dart GoRoute( path: '/books', builder: (ctx,...
@VaporGraphic I currently use this workaround ```dart import 'package:flutter/widgets.dart'; class GoRouteWrapper extends StatefulWidget { const GoRouteWrapper({ required this.child, this.onInit, this.onChangeDependencies, this.onAfterLayout, this.onDispose, super.key, }); final Widget child; final void Function()?...
You don't have to implement anything, just copy-paste the code above to the separate `utils/go_route_wrapper.dart` file, and use it as indicated on a screenshot.
@leoshusar You can do it at the code generation step. As far as I know, `jugger_generator` uses this approach. If you forgot to provide some dependencies, the build runner will...