FlintModelApi<T> class
Browser client for conventional FlintDart model/resource endpoints.
It expects the common FlintDart response envelope:
{"status": "success", "data": {...}}
Plain list/object responses are also accepted.
Constructors
-
FlintModelApi({required String path, required JsonModelFactory<
T> fromJson, ClientRouter? router}) - Creates a model API client.
- FlintModelApi.records(String path, {ClientRouter? router})
-
Creates an API that returns FlintModelRecord objects.
factory
Properties
-
fromJson
→ JsonModelFactory<
T> -
Converts response JSON into a client model.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- path → String
-
Base API path, for example
/plans.final - router → ClientRouter
-
Router used for HTTP calls.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
create(
Map< String, dynamic> data) → Future<T> -
Creates a record with
POST path. -
delete(
Object id) → Future< void> -
Deletes a record with
DELETE path/:id. -
find(
Object id) → Future< T> -
Fetches one record from
GET path/:id. -
list(
{Map< String, dynamic> ? query}) → Future<List< T> > -
Lists records from
GET path. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
update(
Object id, Map< String, dynamic> data) → Future<T> -
Updates a record with
PUT path/:id.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited