Skip to content

Instantly share code, notes, and snippets.

@micimize
Last active November 10, 2019 19:54
Show Gist options
  • Save micimize/ec9df3c1df23f415621fd3da7e81209e to your computer and use it in GitHub Desktop.
Save micimize/ec9df3c1df23f415621fd3da7e81209e to your computer and use it in GitHub Desktop.
An approach for sane graphql-style fragment inheritence in dart https://dartpad.dartlang.org/ec9df3c1df23f415621fd3da7e81209e
// base type
class Foo {
String _foo;
int _bar;
}
//fragment exposing foo
class FooFragment extends Foo {
String get foo => _foo;
set foo(String value) => _foo = value;
FooFragment({String foo}) {
this.foo = foo;
}
}
void main() {
print(FooFragment(foo: 'foo').foo);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment