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';
4
4
5
5
/// A class that implements JsonConverter to convert Color objects to and from JSON.
6
6
class ColorConverter implements JsonConverter <Color , String > {
7
+ /// A class that implements JsonConverter to convert Color objects to and from JSON.
8
+ const ColorConverter ();
9
+
7
10
/// Converts a hexadecimal color string from JSON to a Color object.
8
11
///
9
12
/// 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() {
12
12
[const Color (0xFFFFFFFF ), '#ffffffff' ],
13
13
[const Color (0xF1F1F1F1 ), '#f1f1f1f1' ],
14
14
], (Color color, String expected) {
15
- final result = ColorConverter ().toJson (color);
15
+ final result = const ColorConverter ().toJson (color);
16
16
17
17
expect (result, expected);
18
18
});
@@ -25,7 +25,7 @@ void main() {
25
25
[const Color (0xF1F1F1F1 ), '#f1f1f1f1' ],
26
26
[const Color (0xFFFFFFFF ), '#ffffff' ],
27
27
], (Color expected, String json) {
28
- final result = ColorConverter ().fromJson (json);
28
+ final result = const ColorConverter ().fromJson (json);
29
29
30
30
expect (result, expected);
31
31
});
You can’t perform that action at this time.
0 commit comments