shardIds top-level property

List<int> shardIds

The shards to spawn in this process. Only for use in spawned processes.

Invoking this getter in a process that was not spawned by nyxx_sharding will throw a ShardingError.

Implementation

List<int> get shardIds {
  if (Platform.environment.containsKey('NYXX_SHARDING_SHARD_IDS')) {
    return List.of(Platform.environment['NYXX_SHARDING_SHARD_IDS']!.split(',').map(int.parse));
  }
  throw ShardingError('Missing NYXX_SHARDING_SHARD_IDS variable');
}