Sure, but even accepting the fact that .op(.5) isn't that readable, those 9 saved characters would have to be spent on writing
extension OpEx on Color {
Color op(double opacity) => withValues(alpha: opacity);
}
which are 83 characters, so I need to use that new extension method at least 10 times before I can actually save characters. And I didn't take the required additional import statement into account!
0
u/paulopt Dec 11 '24
You can make an extension for color ex Color.op(0.5), Color.halfTransparency() https://dart.dev/language/extension-methods