Change mapping and bug fixes
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
import 'package:dart_mappable/dart_mappable.dart';
|
||||
|
||||
class IntervalInSecondsConverter implements JsonConverter<Duration, int> {
|
||||
const IntervalInSecondsConverter();
|
||||
class IntervalInSecondsMapper extends SimpleMapper<Duration> {
|
||||
const IntervalInSecondsMapper();
|
||||
|
||||
@override
|
||||
Duration fromJson(int json) => Duration(seconds: json);
|
||||
Duration decode(dynamic value) => Duration(seconds: value as int);
|
||||
|
||||
@override
|
||||
int toJson(Duration object) => object.inSeconds;
|
||||
dynamic encode(Duration self) => self.inSeconds;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user