000000000000000000000
000000000000000000000

Reputation: 1467

Function<String, int> in Dart?

I have a function with a callback void doSth(Function callback), however I would like to specify the parameters and return value of the callback like in Java.

Is this possible in Dart?
(I can't use Future here)

Upvotes: 1

Views: 1139

Answers (1)

Günter Zöchbauer
Günter Zöchbauer

Reputation: 657148

void doSth(String Function callback(int /* type for parameter */ ))

See also https://www.dartlang.org/guides/language/effective-dart/design#prefer-inline-function-types-over-typedefs

Upvotes: 2

Related Questions