OperationMap<OT extends ProgramOperation> constructor Null safety

OperationMap<OT extends ProgramOperation>(
  1. {required int registerBase,
  2. required List<List<MKey<OT>?>> keys,
  3. required List<OT> numbers,
  4. required List<OT> special,
  5. required Map<OT, ArgDone> shortcuts}
)

Implementation

factory OperationMap(
    {required int registerBase,
    required List<List<MKey<OT>?>> keys,
    required List<OT> numbers,
    required List<OT> special,
    required Map<OT, ArgDone> shortcuts}) {
  final instance = _instance;
  if (instance == null) {
    final i = _instance = OperationMap<OT>._internal(
        registerBase, keys, numbers, special, shortcuts);
    i._initialize();
    return i;
  } else {
    assert(instance.registerBase == registerBase);
    assert(instance.keys == keys);
    assert(instance.numbers == numbers);
    assert(instance.special == special);
    return instance as OperationMap<OT>;
  }
}