Skip to content

Reduce ceremony with small samples #96492

@timsneath

Description

@timsneath

Some of our examples have quite a lot of ceremony / boilerplate associated with them (relative to the actual example code). For example:
https://github.com/flutter/flutter/blob/master/examples/api/lib/rendering/sliver_grid/sliver_grid_delegate_with_fixed_cross_axis_count.0.dart

We don't need so much ceremony around declaring a new StatelessWidget, passing a _title, etc., do we? I get that we want to show best practices, but I worry that in situ examples like this make it hard for a learner to see the wood from the trees. @Hixie mentions that there's some things we should keep like putting the example in a widget and runApp()ing that widget, so that hot reload works, but that the current boilerplate is mostly a historical accident.

Can we trim our basic template a little?

Metadata

Metadata

Assignees

Labels

c: contributor-productivityTeam-specific productivity, code health, technical debt.c: proposalA detailed proposal for a change to Flutterd: examplesSample code and demos

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions