smart_text.dart and smart_selectable_text.dart are near-identical. Ignoring the Text versus SelectableText difference, roughly 200 lines are duplicated, including all six span-building branches and the tap handler.
// TODO: Merge the SmartText and SmartSelectableText widgets at smart_text.dart:9 already records this.
The duplication is why the four ignored parameters diverged between the two widgets, and it means every roadmap change (config map, new types, recognizer disposal, caching) has to be made twice, correctly, in both files.
Fix: extract span building into one shared function or a shared base State, leaving each widget with its constructor and its choice of Text or SelectableText.
Worth doing before the type expansion rather than after.
Found during the v0.4.0 codebase audit.
smart_text.dartandsmart_selectable_text.dartare near-identical. Ignoring theTextversusSelectableTextdifference, roughly 200 lines are duplicated, including all six span-building branches and the tap handler.// TODO: Merge the SmartText and SmartSelectableText widgetsatsmart_text.dart:9already records this.The duplication is why the four ignored parameters diverged between the two widgets, and it means every roadmap change (config map, new types, recognizer disposal, caching) has to be made twice, correctly, in both files.
Fix: extract span building into one shared function or a shared base State, leaving each widget with its constructor and its choice of
TextorSelectableText.Worth doing before the type expansion rather than after.
Found during the v0.4.0 codebase audit.