Skip to content

Instantly share code, notes, and snippets.

@afucher
Created July 27, 2022 13:13
Show Gist options
  • Save afucher/b7795b6e431c8d4be41a22a895d577d6 to your computer and use it in GitHub Desktop.
Save afucher/b7795b6e431c8d4be41a22a895d577d6 to your computer and use it in GitHub Desktop.
divine-spray-6506
class Foo {
final String? p1;
const Foo({
this.p1 = "default"
});
}
void main() {
const foo1 = Foo();
print(foo1.p1);
final foo2 = Foo(p1: "no default");
print(foo2.p1);
final foo3 = Foo(p1: null);
print(foo3.p1);
final Map<Symbol, dynamic> namedArgs = {};
final foo4 = Function.apply(Foo.new, null, namedArgs);
print(foo4.p1);
namedArgs[#p1] = "apply value";
final foo5 = Function.apply(Foo.new, null, namedArgs);
print(foo5.p1);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment