18 lines
475 B
Dart
18 lines
475 B
Dart
|
import 'dart:ui';
|
||
|
|
||
|
import 'package:intl/intl.dart';
|
||
|
|
||
|
String formatDate(DateTime time) {
|
||
|
return DateFormat('EEEE, dd MMMM yyyy').format(time);
|
||
|
}
|
||
|
|
||
|
DateTime dateFromJson(int value) => DateTime.fromMillisecondsSinceEpoch(value);
|
||
|
|
||
|
int dateToJson(DateTime? value) =>
|
||
|
value == null ? 0 : value.millisecondsSinceEpoch;
|
||
|
|
||
|
String colorToJson(Color color) =>
|
||
|
color.toString().split('(0x')[1].split(')')[0];
|
||
|
|
||
|
Color colorFromJson(String hex) => Color(int.parse(hex, radix: 16));
|