Skip to content

Instantly share code, notes, and snippets.

@mehmetf
Last active May 8, 2020 19:34
Show Gist options
  • Save mehmetf/e00fcb718f3592ac05d91a062d26cba0 to your computer and use it in GitHub Desktop.
Save mehmetf/e00fcb718f3592ac05d91a062d26cba0 to your computer and use it in GitHub Desktop.
Passing Params
class MyPage extends StatelessWidget {
final int accountId;
final int scopeId;
MyPage(this.accountId, this.scopeId);
Widget build(BuildContext context) {
return new MyWidget(accountId, scopeId);
}
}
class MyWidget extends StatelessWidget {
final int accountId;
final int scopeId;
MyWidget(this.accountId, this.scopeId);
Widget build(BuildContext context) {
// somewhere down the line
new MyOtherWidget(accountId, scopeId);
...
}
}
class MyOtherWidget extends StatelessWidget {
final int accountId;
final int scopeId;
MyOtherWidget(this.accountId, this.scopeId);
Widget build(BuildContext context) {
// rinse and repeat
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment