-
Notifications
You must be signed in to change notification settings - Fork 30.6k
Migrate cross-library docImports before decoupling #181288
Copy link
Copy link
Open
Labels
P1High-priority issues at the top of the work listHigh-priority issues at the top of the work lista: tests"flutter test", flutter_test, or one of our tests"flutter test", flutter_test, or one of our testsc: proposalA detailed proposal for a change to FlutterA detailed proposal for a change to Flutterf: cupertinoflutter/packages/flutter/cupertino repositoryflutter/packages/flutter/cupertino repositoryf: material designflutter/packages/flutter/material repository.flutter/packages/flutter/material repository.frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.team-frameworkOwned by Framework teamOwned by Framework teamtriaged-frameworkTriaged by Framework teamTriaged by Framework team
Description
Metadata
Metadata
Assignees
Labels
P1High-priority issues at the top of the work listHigh-priority issues at the top of the work lista: tests"flutter test", flutter_test, or one of our tests"flutter test", flutter_test, or one of our testsc: proposalA detailed proposal for a change to FlutterA detailed proposal for a change to Flutterf: cupertinoflutter/packages/flutter/cupertino repositoryflutter/packages/flutter/cupertino repositoryf: material designflutter/packages/flutter/material repository.flutter/packages/flutter/material repository.frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.team-frameworkOwned by Framework teamOwned by Framework teamtriaged-frameworkTriaged by Framework teamTriaged by Framework team
Type
Fields
Give feedbackNo fields configured for issues without a type.
Projects
StatusShow more project fields
No status
Dart docImports allow you to reference identifiers from outside of the current file using square brackets in Dart Doc. The framework contains many of these that reference Material or Cupertino and will need to be migrated before decoupling can be completed.
What should we do about problematic docImports?
docImports are problematic when they reference Material or Cupertino from outside of that referenced library. For example,
widgets/scrollbar.dartreferences both Material and Cupertino so that it can refer to things like[Scrollbar]and[CupertinoScrollbar]in its docs.flutter/packages/flutter/lib/src/widgets/scrollbar.dart
Lines 5 to 6 in 3b20617
Option 0: Do nothing
This is not viable in the long term because it will break dart doc after Material and Cupertino are removed from flutter/flutter. The references in the example above to
material.dartandcupertino.dartwill not be found.In the short term immediately after decoupling, because we plan to keep the original Material and Cupertino code in flutter/flutter during a deprecation period, it will not break anything. However, users that click on these links in the framework docs will be taken to the deprecated versions of this code, which is misleading.
Option 1: Remove affected docImports
We could remove the problematic docImports and replace the linked identifiers with unlinked inline code. In the scrollbar.dart example above, we would remove the two docImports and replace
[Scrollbar]with`Scrollbar`.This is an imperfect solution because users of our docs would lose a lot of useful links.
Options 2: Migrate each problematic docImport to reference the new external package
Does dartDoc support referencing something from an external Pub package? How?
Where are problematic docImports located?
Problematic docImports have been seen in the following places, but they may also exist elsewhere:
How can we prevent this problem in the future?
We should ideally include a lint that can catch problematic docImports, similar to what was done for cross-library test imports in #178693.
Links
This was discovered by @navaronbracke in: https://github.com/flutter/flutter/pull/180456/files#r2700767565