Omar Kamel

Results 206 comments of Omar Kamel

I created a helper method like so: ```dart Block ifStatement( Expression conditional, Code body, [ bool singleLine = false, ]) => Block.of([ Code('if ('), conditional.code, Code(') {'), body, Code('}'), ]);...

i think that it doesnt really make sense to have that inconsistency. factory constructors also make it easier to discover and use M3 variants without having to actively look for...

Its pretty weird that generic argument factories doesnt work when the toJson is specified in a mixin, but without generic factories it works fine? shouldnt it look up the method...

Why not let it be `R Function`? no real need to change how the return type is defined

> Wouldn't that conflict with a generic function? > > ```dart > typedef Adder = T Function(T a, T b); > ``` no, because you MUST have a parameter list...

> If we wanted a type to abstract over function parameter signatures, we could just do introduce > > ```dart > R Function(..., {...}) > ``` > > to represent...

It could also be useful for storing parameters and comparing against parameters that are sent in later. if they're ==, just return the cached value, as an example

I currently use this provider for mutations (and yes, the `FutureOr` is necessary, though you could change it to `Future` and mark it async) ```dart import 'package:riverpod_annotation/riverpod_annotation.dart'; part 'mutation_provider.g.dart'; @riverpod...

you can always try and adjust it to return the success data if you want, but ideally you should be calling notifier methods from other providers that handle the data...

I've improved my approach a lot, with some suggestions by remi. This mirrors the approach that the code gen solution will have, at least as far as api is concerned...