0 purchases
tbib gen timezone serializable
Tbib Gen Timezone Serializable #
Setup #
Use it for make json serializable support TZDateTime Field
step 1 #
note use flutter_timezone to get Local Timezone
String location=FlutterTimezone.getLocalTimezone();
JsonTimezoneSerializable.init = location;
copied to clipboard
step 2 #
use @JsonTimezoneConverter() above TZDateTime
@JsonSerializable()
class GenerateTimezone {
@JsonTimezoneConverter()
final TZDateTime timezone;
GenerateTimezone(this.date, this.timezone);
factory GenerateTimezone.fromJson(Map<String, dynamic> json) =>
_$GenerateTimezoneFromJson(json);
}
copied to clipboard
Note #
don't use timezone.toIso8601String();
but use timezone.toIso8601();
in version 0.0.2 can format date
click here to more details
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.