Skip to content

analyzer_testing stub for 'dart:ui' is placed at 'package:ui' #62234

@srawlins

Description

@srawlins

The existing mocks (stubs, really) we provide for tests that need 'dart:ui' actually provide a 'package:ui'. And that 'package:ui' is then referenced in some flutter library stubs.

This is very surprising to me; I think the surprisingness is a big downside to this fudging of the real 'dart:ui'. It's manageable when only the analyzer folks are using the stubs, but not so much when analyzer plugin authors would need to write import 'package:ui/ui.dart' in tests, to import classes like Color.

The upsides of the current state is simplicity; it is perhaps complicated to provide a 'dart:ui' in our mock (stub) SDK, and so a package called 'ui' simplifies things. Also, the mock SDK used in tests is cached between tests, which adds another wrinkle.

Anyhow, I believe we really should correct these stubs which veer away from the true 'dart:ui' code.

I also strongly suggest that we just make it the standard. We could either provide a 'dart:ui' in the mock SDK used for all tests, or make it configurable. The configurability would I think require us to abandon or complicate the mock SDK caching, which I believes saves a lot of time when running analyzer and analysis server tests, both locally and on bots. Most Dart users are using a Dart SDK which has a 'dart:ui' library, so always providing one makes the common case the standard.

Metadata

Metadata

Assignees

Labels

P2A bug or feature request we're likely to work onarea-devexpFor issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.devexp-plugintype-enhancementA request for a change that isn't a bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions