Say I have the following:
class SomeObject<TModel> extends StatelessWidget {
final TModel someModel;
final Widget Function(TModel model) builder;
SomeObject({required this.someModel, required this.builder});
}
and I use this like this:
return SomeObject(someModel: SomeModel(), builder: (model) => {do something});
What I'm seeing is that SomeObject doesn't get the type of TModel inferred by SomeModel() setting someModel as I would see automatically happen in C# and thus builder: (model) is Object? instead of the correct type of someModel
How does one annotate to get dart to know that someModel being set defines the overall type of TModel for all of SomeObject and thus assign the builder: (model) to the right SomeObject automatically?