flutter / flutter/flutter

Minimize cross imports in examples

Open
#190,305 0 comments 1 reaction 0 assignees View on GitHub
d: examples framework P2 team-framework triaged-framework
Dominant language
Dart
Stars
179k
Forks
31.1k
PR merge metrics
PR metrics pending

Description

The examples, located [in the package root](https://github.com/flutter/flutter/tree/master/examples) and [in packages/flutter](https://github.com/flutter/flutter/tree/master/packages/flutter/examples), should avoid cross imports.

* If an example is unrelated to Material and Cupertino, consider refactoring it to only use Widgets.
* If an example is realted to Material or Cupertino, consider moving it to material_ui or cupertino_ui.

See [knownExamplesCrossImports](https://github.com/flutter/flutter/blob/master/dev/bots/check_examples_cross_imports.dart#L117), which contains a list of all example files with cross imports. The examples in [api/lib/material](https://github.com/flutter/flutter/tree/master/packages/flutter/examples/api/lib/material) and [api/lib/cupertino](https://github.com/flutter/flutter/tree/master/packages/flutter/examples/api/lib/cupertino) do not need to be migrated because they have already been moved to material_ui or cupertino_ui.

As discussed in https://github.com/flutter/flutter/pull/190237#discussion_r3684846579, there's a small amount of concern for these imports of material_ui and cupertino_ui causing complicated migrations.

Part of https://github.com/flutter/flutter/issues/177028

Contributor guide

Open the contributing guide

Research direction

Start with dev/bots/check_examples_cross_imports.dart and its knownExamplesCrossImports list, then inspect the examples under examples and packages/flutter/examples. Separate examples that can use Widgets from those related to Material or Cupertino, while leaving packages/flutter/examples/api/lib/material and api/lib/cupertino unchanged. Done means the remaining listed cross imports are addressed without introducing complicated material_ui or cupertino_ui migrations.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart
Domain
tooling
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.