2024-02-17 11:58:34 +03:30
|
|
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
2023-12-01 12:56:24 +03:30
|
|
|
|
2024-02-17 11:58:34 +03:30
|
|
|
class IntervalInSecondsConverter implements JsonConverter<Duration, int> {
|
|
|
|
|
const IntervalInSecondsConverter();
|
2023-12-01 12:56:24 +03:30
|
|
|
|
|
|
|
|
@override
|
2024-02-17 11:58:34 +03:30
|
|
|
Duration fromJson(int json) => Duration(seconds: json);
|
2023-12-01 12:56:24 +03:30
|
|
|
|
|
|
|
|
@override
|
2024-02-17 11:58:34 +03:30
|
|
|
int toJson(Duration object) => object.inSeconds;
|
2023-12-01 12:56:24 +03:30
|
|
|
}
|