File tree Expand file tree Collapse file tree 2 files changed +5
-2
lines changed
Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,9 @@ import 'package:freezed_annotation/freezed_annotation.dart';
44
55/// A class that implements JsonConverter to convert Color objects to and from JSON.
66class ColorConverter implements JsonConverter <Color , String > {
7+ /// A class that implements JsonConverter to convert Color objects to and from JSON.
8+ const ColorConverter ();
9+
710 /// Converts a hexadecimal color string from JSON to a Color object.
811 ///
912 /// The input string [json] is expected to be a hexadecimal color string.
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ void main() {
1212 [const Color (0xFFFFFFFF ), '#ffffffff' ],
1313 [const Color (0xF1F1F1F1 ), '#f1f1f1f1' ],
1414 ], (Color color, String expected) {
15- final result = ColorConverter ().toJson (color);
15+ final result = const ColorConverter ().toJson (color);
1616
1717 expect (result, expected);
1818 });
@@ -25,7 +25,7 @@ void main() {
2525 [const Color (0xF1F1F1F1 ), '#f1f1f1f1' ],
2626 [const Color (0xFFFFFFFF ), '#ffffff' ],
2727 ], (Color expected, String json) {
28- final result = ColorConverter ().fromJson (json);
28+ final result = const ColorConverter ().fromJson (json);
2929
3030 expect (result, expected);
3131 });
You can’t perform that action at this time.
0 commit comments