safeNullable method

String? safeNullable(
  1. String key, {
  2. String? defaultValue,
})

Implementation

String? safeNullable(String key, {String? defaultValue}) {
  if (this[key] != null) {
    final stringValue = this[key].toString();
    return stringValue.isEmpty || stringValue == 'null' ? defaultValue : stringValue;
  }
  return defaultValue;
}