replaceTable method Null safety

void replaceTable(
  1. SchemaTable existingTable,
  2. SchemaTable newTable
)

Implementation

void replaceTable(SchemaTable existingTable, SchemaTable newTable) {
  if (!_tableStorage!.contains(existingTable)) {
    throw SchemaException(
      "Table ${existingTable.name} does not exist and cannot be replaced.",
    );
  }

  final index = _tableStorage!.indexOf(existingTable);
  _tableStorage![index] = newTable;
  newTable.schema = this;
  existingTable.schema = null;
}