Model<T extends Model<T> > class
abstract
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- id → dynamic
-
Get the current ID
no setter
- primaryKey → String
-
Primary key column
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- table → Table
-
Table schema definition
no setter
Methods
-
all(
) → Future< List< T> > - Get all records
-
count(
) → Future< int> - Count all records
-
countWhere(
String field, dynamic value) → Future< int> - Count records with condition
-
create(
[Map< String, dynamic> ? data]) → Future<T?> - Insert new record (works for both PostgreSQL and MySQL)
-
delete(
[dynamic id]) → Future< bool> - Delete this model Delete this model
-
find(
dynamic id) → Future< T?> - Find by ID Find by ID
-
fromMap(
Map< String, dynamic> map) → T - Convert map to model
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
query(
) → QueryBuilder - Custom query builder
-
refresh(
[dynamic id]) → Future< T?> - Refresh the model from DB
-
save(
) → Future< T?> - Save model (create or update)
-
toMap(
) → Map< String, dynamic> - Convert model to map
-
toString(
) → String -
A string representation of this object.
inherited
-
truncate(
) → Future< void> - Truncate table
-
update(
[dynamic id, Map< String, dynamic> ? data]) → Future<T?> - Update existing record using the helper method
-
where(
String field, dynamic value) → Future< List< T> > - Where clause
-
whereIn(
String field, List values) → Future< List< T> > - Find records with custom conditions
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited