Last active
November 10, 2019 19:54
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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