TypeUfixed.valueOf constructor

TypeUfixed.valueOf(
  1. String scheme
)

Implementation

factory TypeUfixed.valueOf(String scheme) {
  final r = RegExp(r'^ufixed([1-9][\d]*)x([1-9][\d]*)$');
  if (!r.hasMatch(scheme)) {
    throw ArgumentError('static array type ill format');
  }

  final m = r.firstMatch(scheme);
  final size = m?.group(1);
  final precision = m?.group(2);
  if (size == null || precision == null) {
    throw ArgumentError('No match found in scheme.');
  }

  return TypeUfixed(
    int.parse(size, radix: 10),
    int.parse(precision, radix: 10),
  );
}