valueToString method

  1. @override
String valueToString(
  1. Map<String, dynamic> x
)
override

Implementation

@override
String valueToString(Map<String, dynamic> x) {
  for (final fEntry in _fields) {
    final name = fEntry.key, type = fEntry.value;
    if (x.containsKey(name)) {
      final value = type.valueToString(x[name]);
      if (value.isEmpty || value == 'null') {
        return 'variant {$name}';
      } else {
        return 'variant {$name=$value}';
      }
    }
  }
  throw StateError('variant has no data: $x.');
}