HosseinYousefi · GitHub

Describe the bug
If the name of the class finishes with Colors, VSCode shows a preview as if the class name was Colors. (see the screenshot)

To Reproduce
You can use this code:

import 'dart:ui';
class MyColors {
  static const red = Color(0xff00ff00);
}
class NoColorHere {
  static const red = Color(0xff00ff00);
}
void somefunction() {
  final someOtherColor = NoColorHere.red;
  final someColor = MyColors.red;
}

Expected behavior
Preferably it should show the actual color in all cases, but a quick fix could be to not show the color preview when the class is not "Colors".

Screenshots
Screenshot 2020-10-08 at 10 49 29

Versions (please complete the following information):

  • VS Code version: 1.49.3
  • Dart extension version: 3.15.0
  • Dart/Flutter SDK version: 2.8.4/Flutter 1.17.5

Read the original on github.com ↗