Skip to content

[Decoupling] Migrate flutter_test to material_ui and cupertino_ui #186966

Description

@justinmc

The flutter_test package sometimes imports material.dart (example) and cupertino.dart (example). In the course of decoupling, it should be migrated to material_ui and cupertino_ui, or decoupled entirely.

Possible complications

It's risky for both material.dart and material_ui to depend on flutter_test while it uses only one of them. For example, find.byTooltip does a type comparison using a type it imports from material.dart:

if (widget is Tooltip) {

This comparison will always return false when called from material_ui, because material_ui has its own Tooltip implementation that is not treated as equivalent to the material.dart implementation.

I've hacked around this particular problem in the main decoupling PR (flutter/packages#11669) by duplicating this finder. I'm unaware of other immediate complications, but we should watch out!

What to do about it

  • Option 1: Wait for material.dart and cupertino.dart to be deprecated, then migrate flutter_test to material_ui and cupertino_ui. Hope there are no other complications in the meantime.
  • Option 2: Decouple flutter_test from Material and Cupertino altogether.

I recommend we go with Option 2 if we have the bandwidth to do it. There are only two material imports in the actual flutter_test code (rg "material.dart" packages/flutter_test/lib) and one cupertino import (rg "cupertino.dart" packages/flutter_test/lib). After decoupling, we should deprecate byTooltip and any other APIs that depend on Material/Cupertino, and move them into material_ui/cupertino_ui themselves.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1High-priority issues at the top of the work lista: tests"flutter test", flutter_test, or one of our testsf: cupertinoflutter/packages/flutter/cupertino repositoryf: material designflutter/packages/flutter/material repository.team-designOwned by Design Languages teamtriaged-designTriaged by Design Languages team

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions