ByIdentityValue.fromJson constructor

ByIdentityValue.fromJson(
  1. dynamic data
)

Implementation

factory ByIdentityValue.fromJson(dynamic data) {
  if (data is! List<dynamic>) {
    throw const FormatException('expected an array');
  }
  final integers = data.whereType<int>().toList(growable: false);
  if (integers.length != 2) {
    throw const FormatException('expected an array with two integers');
  }

  return ByIdentityValue(leaderSlots: integers[0], blocksProduced: integers[1]);
}