freezed_milliseconds_to_datetime_converter

Last updated:

0 purchases

freezed_milliseconds_to_datetime_converter Image
freezed_milliseconds_to_datetime_converter Images
Add to Cart

Description:

freezed milliseconds to datetime converter

Easily transform your int properties into DateTimes.
What: #

Before

@freezed
class Task with _$Task {
const factory Task({
required int createdAt,
int? updatedAt,
}) = _Task;
}
copied to clipboard

After

@freezed
class Task with _$Task {
const factory Task({
@MillisecondsToDateTimeConverter() required DateTime createdAt,
@OptionalMillisecondsToDateTimeConverter() DateTime? updatedAt,
}) = _Task;
}
copied to clipboard
How: #

Change your ints to DateTimes as shown in previous section
Run builder to rebuild the freezed classes:


dart run build_runner build --delete-conflicting-outputs

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.