Saturday, 7 September 2013

Define function signature for a class member in Dart

Define function signature for a class member in Dart

I would like to specify the signature of a function used as a class field.
Here is an example:
class Space<PointType>
{
// num distance(PointType, PointType); This does not work
final distance; // This works but dystance types are not defined
Space(num this.distance(PointType, PointType));
}
I know I can use typedef to define a callback interface. However this does
not seem to work within generics. Any suggestions?

No comments:

Post a Comment