Passing class static factory as method parameter in Dart. Dart currently does not allow using constructors as tear-offs. I recommend using a static method instead.
Alternatively you could just create an explicit closure:
1 2 3 4 5 | class ArticleService { Future<Model> read() => HttpGet<Article>({ createModelFromJson: (json) => Article.fromJson(json), }).do(); } |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.