insertRow<T> static method

OptimisticChange insertRow<T>(
  1. TableCache<T> table,
  2. T row
)

Build an insert change from a typed row. The SDK extracts the table name and serializes the row via the decoder — no hand-typed map and no stringly-typed table name.

optimisticChanges: [
  OptimisticChange.insertRow(client.note, Note(id: tempId, title: 'Hi', body: 'there')),
],

Throws UnsupportedError if the decoder does not implement toJson (regenerate the table decoder to add it).

Implementation

static OptimisticChange insertRow<T>(TableCache<T> table, T row) {
  return OptimisticChange.insert(table.tableName, _requireJson(table, row));
}