IdUid.fromString constructor

IdUid.fromString(
  1. String? str
)

Implementation

factory IdUid.fromString(String? str) {
  if (str == null || str == '' || str == '0:0') {
    return const IdUid.empty();
  }

  final spl = str.split(':');
  if (spl.length != 2) {
    throw ArgumentError.value(str, 'str', 'IdUid has invalid format');
  }
  return IdUid(_parse('id', spl[0]), _parse('uid', spl[1]));
}