brianegan / brianegan/new_flutter_template

How should objects be constructed and passed down the tree?

Open
#9 9 comments 2 reactions 0 assignees View on GitHub
Dominant language
Dart
Stars
138
Forks
21
PR merge metrics
No merged PRs in 30d

Description

There are many ways to pass values from parent to descendant Widgets. Passing via constructors can be educational for newer Flutter developers, but most projects appear to include some kind of library like Provider, Riverpod or get_it to make such passing easier.

Should the template provide concrete guidance on how to pass dependencies down the Widget tree, or should the template pass dependencies via normal Class constructors?

- [Plain Dart instances and constructors](https://github.com/brianegan/new_flutter_template/blob/main/evaluations/list_detail_mvc/lib/main.dart#L27)
- Community Solution, such as [Provider](https://github.com/brianegan/new_flutter_template/blob/main/evaluations/list_detail_mvc_provider/lib/main.dart#L11), [Get_it](https://github.com/brianegan/new_flutter_template/blob/main/evaluations/list_detail_mvc_vn_two_features_boilerplate_getit/lib/main.dart#L13), or [Riverpod](https://github.com/brianegan/new_flutter_template/blob/main/evaluations/list_detail_mvc_riverpod/lib/src/users/user_list_controller.dart#L7)
- Other (please let us know!)

Contributor guide

No contributing guide indexed for this repository

Research direction

Read the linked examples in evaluations/list_detail_mvc/lib/main.dart, evaluations/list_detail_mvc_provider/lib/main.dart, evaluations/list_detail_mvc_vn_two_features_boilerplate_getit/lib/main.dart, and evaluations/list_detail_mvc_riverpod/lib/src/users/user_list_controller.dart. Compare the constructor, Provider, Get_it, and Riverpod approaches, then review the discussion for a settled direction. Done means the template's dependency-passing approach and guidance are explicitly decided and reflected in the relevant examples.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart, flutter
Domain
mobile
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.