GridSheetRowState enum
Change tracking state for grid rows.
This enum tracks the lifecycle state of rows for change detection and persistence. Each row has exactly one state at any time.
State Transitions
[existing] ──(edit)──> [modified] ──(delete)──> [deleted]
│ │
└────(delete)──────────┘
[inserted] ──(edit)──> [inserted] (stays inserted)
│
└────(delete)──> [removed from grid]
Example
// Check row state
if (row.state == GridSheetRowState.inserted) {
// New row - send as CREATE
await api.createRow(row);
} else if (row.state == GridSheetRowState.modified) {
// Changed row - send as UPDATE
await api.updateRow(row);
} else if (row.state == GridSheetRowState.deleted) {
// Deleted row - send as DELETE
await api.deleteRow(row);
}
// Get all changes
final changes = rows.where((r) =>
r.state == GridSheetRowState.inserted ||
r.state == GridSheetRowState.modified ||
r.state == GridSheetRowState.deleted
).toList();
See also:
- GridSheetRow.state, which stores the current state
- GridSheetRow.markAsInserted, GridSheetRow.markAsModified, GridSheetRow.markAsDeleted
Values
- existing → const GridSheetRowState
-
Original row from data source (unchanged).
This is the default state for rows loaded from the initial dataset. Rows in this state don't need to be persisted unless they transition to modified or deleted.
- inserted → const GridSheetRowState
-
Newly inserted row not yet persisted.
Rows in this state were created by the user and need to be sent to the backend as CREATE operations. Edited inserted rows remain in the inserted state.
- modified → const GridSheetRowState
-
Existing row that was edited.
Rows transition to this state when edited if they were previously in the existing state. These need to be sent as UPDATE operations.
- deleted → const GridSheetRowState
-
Row marked for deletion (soft delete).
Rows in this state remain in memory for payload generation but may be filtered out of the visible list. These need to be sent as DELETE operations.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- index → int
-
A numeric identifier for the enumerated value.
no setterinherited
- name → String
-
Available on Enum, provided by the EnumName extension
The name of the enum value.no setter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
-
values
→ const List<
GridSheetRowState> - A constant List of the values in this enum, in order of their declaration.