tbib_gen_timezone_serializable 1.0.1+1 copy "tbib_gen_timezone_serializable: ^1.0.1+1" to clipboard
tbib_gen_timezone_serializable: ^1.0.1+1 copied to clipboard

This Package for support TZDateTime to Json 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;

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);
      }
    
    

    Can make date time picker #

TBIBDatePickerFormField(
          title: 'Date time picker',
          onSaved: (value) {},
          datePickerStyle: TBIBDatePickerStyle(
            isDateAndTime: true,
            getTime: ({required date}) {
              log('date time is $date');
            },
            initDate: DateTime.now().add(const Duration(days: 5)),
            startDate: DateTime.now(),
            endDate: DateTime.now().add(const Duration(days: 10)),
          ),
        ),

Note #

0
likes
160
points
0
downloads

Publisher

unverified uploader

Weekly Downloads

This Package for support TZDateTime to Json serializable.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, json_annotation, tbib_timezone_offset, timezone

More

Packages that depend on tbib_gen_timezone_serializable