parseString static method

String? parseString(
  1. Object? value, [
  2. String? def
])

Tries to parse a String.

  • Returns def if value is null.

Implementation

static String? parseString(Object? value, [String? def]) {
  if (value == null) return def;

  if (value is String) {
    return value;
  } else {
    return '$value';
  }
}