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

27 lines
539 B
Dart

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