Last updated:
0 purchases
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
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.