shard property

({int shardNumber, int totalShards})? get shard

Sharding information for this test run.

Implementation

({int shardNumber, int totalShards})? get shard {
  final shardValue = argResults[_shardArg];
  if (shardValue is String) {
    final shardParts = shardValue.split('/');
    if (shardParts.length == 2) {
      final shardNumber = int.tryParse(shardParts[0]);
      final totalShards = int.tryParse(shardParts[1]);
      if (shardNumber is int && totalShards is int) {
        return (shardNumber: shardNumber, totalShards: totalShards);
      }
    }
  }
  return null;
}