parse static method
The shard of text, <index>/<count> such as 2/3, or null if it
is none: an index from 1 to the count.
Implementation
static MatrixShard? parse(String text) {
final match = RegExp(r'^(\d+)/(\d+)$').firstMatch(text);
final index = int.tryParse(match?[1] ?? '');
final count = int.tryParse(match?[2] ?? '');
if (index == null || count == null || index < 1 || index > count) {
return null;
}
return MatrixShard(index, count);
}