ApiQuery<T extends Schema> class
final
Adapter for connect with api
Constructors
- ApiQuery.of(T _createInstance(ResourceObject object), {Options? options, T? current})
- Retrieve singleton
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
all(
) → Future< Iterable< T> > - Execute the query and get all results.
-
allOrNull(
) → Future< Iterable< T> ?> - Execute the query and get all results. If result is null returns null.
-
append(
List< String> attributes) → void - We can also append attributes to our queries using the append method. The arguments are the names of the attributes we want to append. We can pass as many arguments as we want.
-
baseUrl(
) → String - Retrieve current baseURL
-
config(
Options options) → void - Customize options of dio client
-
custom(
List args) → void - Build custom endpoints.
-
delete<
Y> () → Future< Y?> - Delete the model from the database.
-
endpoint(
) → String - Retrieve current endpoint.
-
find(
dynamic id) → Future< T> - Find a model by its primary key. Throws a StateError if this is null.
-
findOrNull(
dynamic id) → Future< T?> - Find a model by its primary key, or null if not result.
-
first(
) → Future< T> - Execute the query and get first result. Throws a StateError if this is null.
-
firstOrNull(
) → Future< T?> - Execute the query and get first result, or null if the result is empty.
-
from(
String url) → void - Lazy load relationships of a model an apply model instances to them.
-
get(
) → Future< Iterable< T> > - Execute the query and get all results.
-
getBuilder(
) → Builder - Retrieve instance of builder
-
getOrNull(
) → Future< Iterable< T> ?> - Execute the query and get all results. If result is null returns null.
-
include(
List< String> args) → void - Sometimes, we will want to eager load a relationship, and to do so, we can use the include method or its alias load. The arguments are the names of the relationships we want to include. We can pass as many arguments as we want.
-
limit(
int value) → void - Set the limit of records per page.
-
load(
List< String> args) → void - Sometimes, we will want to eager load a relationship, and to do so, we can use the by method or its alias include. The arguments are the names of the relationships we want to include. We can pass as many arguments as we want.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
orderBy(
List< String> fields) → void - The method orderBy. The arguments are the names of the properties we want to sort. We can pass as many arguments as we want.
-
page(
int value) → void - Set the current page.
-
paginate(
{String totalField = 'total', String? modelField}) → Future< ResourcePagination< T> > - Retrieve pagination of models
-
paginateOrNull(
{String totalField = 'total', String? modelField}) → Future< ResourcePagination< T> ?> - Retrieve pagination of models or null if not data
-
params(
Map< String, dynamic> payload) → void - We may also need to use parameters that are not provided by dart_api_query, and that's when the params method comes in to help.
-
save(
) → Future< T> - Save or update a model in the database, then return the instance.
-
select(
List< String> fields) → void - The arguments are the names of the fields we want to select of the model
-
selectFromRelations(
Map< String, List< fieldsFromRelationships) → voidString> > - The argument is an object, which the name of the first key is the resource defined in the model class, the name of the other keys are the included relationships, and the values are arrays of fields.
-
toString(
) → String -
A string representation of this object.
inherited
-
when(
dynamic value, void callback(Builder, dynamic)) → void - We may need to add a clause based on a condition, and we can do so by using the when method. The first argument is the flag, and the second argument is the callback with the clause we want.
-
where(
String key, dynamic value) → void - The where method can be used to filter the query by evaluating a value against the column. The first argument is the name of the column, and the second argument is the value to evaluate.
-
whereIn(
String key, List< String> searchArray) → void - The whereIn method is similar to where, but it accepts multiple values instead of a single one. The first argument is the name of the column, and the second argument is an array of values to evaluate.
-
whereInNested(
Map< String, dynamic> nestedFilters) → void - The whereInNested method is similar to whereIn, but is used to filter the query using a nested filter. You can use whereNested or this alias.
-
whereNested(
Map< String, dynamic> nestedFilters) → void - The whereNested method can be used to filter the query by evaluating a nested filter.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited