Length 14:
'''a$b
c
''';
Multi-line Strings are created in Dart using triple quotes. String interpolation still works.
Length 13:
typedef C(a);
You can use the typedef
keyword to assign a name to a function type. Here, C
defines a function that takes a single argument. Now we can refer to C
where we a need a function with that signature:
k(C c) => c;
And calling k
:
k((a) => 4);
This is all very similar to the previous snippet, but can simplify things greatly if we need to continuously refer to a function type.
Length 12:
a(b()) => b;
Dart functions are first class. Here a
is a function that takes another function as an argument and returns it. You could call a
like this:
a(() => 4);
Note that the result of this is not 4, but rather a function with the signature () => dynamic
.
Length 11: