Skip to content

Commit 334ed6a

Browse files
committed
fix decimalintconverter so that it doesnt break the code generation
google/json_serializable.dart#1373 (comment)
1 parent 3b8eb91 commit 334ed6a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/src/types/c2_results.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class C2Results with _$C2Results {
2323
String? timezone,
2424
@Default(0) int distance,
2525
@Default(C2ResultType.rower) C2ResultType type,
26-
@DecimalIntConverter(places: -1) required double time,
26+
@DecimalIntConverter.tenths() required double time,
2727
@JsonKey(name: "workout_type")
2828
@Default(C2APIWorkoutType.JustRow)
2929
C2APIWorkoutType workoutType,
@@ -48,6 +48,9 @@ class DecimalIntConverter implements JsonConverter<double, double> {
4848
final int places;
4949
final int base;
5050

51+
///Create a DecimalIntConverter that can represent a "tenths" value
52+
const DecimalIntConverter.tenths() : this(places: -1);
53+
5154
///[places] how many places to shift the number. Positive is multiplication, negative is division
5255
const DecimalIntConverter({this.places = 0, this.base = 10});
5356

0 commit comments

Comments
 (0)