flutter-freaccess-hub/lib/shared/extensions/string_extensions.dart

27 lines
542 B
Dart

extension StringNullableExtensions on String? {
bool get toBoolean {
if (this == null) return false;
return this!.toLowerCase() == 'true';
}
bool get isNullOrEmpty {
if (this == null) return true;
if (this == '') return true;
return false;
}
bool get isNotNullAndEmpty {
if (this == null) return false;
if (this == '') return false;
return true;
}
}
extension StringExtensions on String {
bool get toBoolean {
return toLowerCase() == 'true';
}
}
extension StringExtension on String? {}