22 lines
639 B
Dart
22 lines
639 B
Dart
class KtUtils {
|
|
static String getTimeZoneOffset(DateTime dateTime) {
|
|
Duration offset = dateTime.timeZoneOffset;
|
|
String sign = offset.isNegative ? '-' : '+';
|
|
int hours = offset.inHours.abs();
|
|
int minutes = (offset.inMinutes.abs() % 60);
|
|
|
|
return 'GMT$sign${hours.toString().padLeft(2, '0')}:${minutes.toString().padLeft(2, '0')}';
|
|
}
|
|
|
|
static bool isEmpty(dynamic value) {
|
|
return value == null ||
|
|
(value is Map && value.isEmpty) ||
|
|
(value is String && value.isEmpty) ||
|
|
(value is Iterable && value.isEmpty);
|
|
}
|
|
|
|
static bool isNotEmpty(dynamic value) {
|
|
return !isEmpty(value);
|
|
}
|
|
}
|