katana_model library
A package that models data into documents and collections and allows Firestore, local DB, and data mocks to be handled in the same interface.
To use, import package:katana_model/katana_model.dart.
Classes
- AllowCreateModelValidationQuery
- Define the validation query to be used by DatabaseValidator.
- AllowDeleteModelValidationQuery
- Allows only document deletion.
- AllowReadCollectionModelValidationQuery
- Allows reading (collections only).
- AllowReadDocumentModelValidationQuery
- Allows reading (documents).
- AllowReadModelValidationQuery
- Allow all reads (documents and collections).
- AllowUpdateModelValidationQuery
- Allows only document updates.
- AllowWriteModelValidationQuery
- Allows only document creation.
- Api
- Provides static methods for making HTTP requests.
- ApiMultipartFile
- A file to be uploaded as part of a ApiMultipartFile.
-
AsyncAggregateValue<
T> - This class is used to asynchronously retrieve values returned from CollectionBase.aggregate, etc.
- AsyncSavingManager
- Manages asynchronous saving operations with a queue system.
- AsyncVectorConverter
- An asynchronous vector value converter.
- Clock
- A class that can be used instead of DateTime.
-
CollectionBase<
TModel extends DocumentBase> - Define a collection model that includes DocumentBase as an element.
- CollectionModelQuery
- Query class for defining Model.
- CollectionModelRestApiBuilder
- Builder for creating collection model adapters using REST APIs.
- CollectionModelRestApiQuery
- Builder for creating collection model adapters using REST APIs.
- DatabaseValidator
- An object that validates information in the database.
- DateDuration
- A class that represents a date period.
- DateFormat
- DateFormat is for formatting and parsing dates in a locale-sensitive manner.
- DeleteDocumentModelRestApiBuilder
- Builder for creating document model adapters for deleting documents using a REST API.
- DeleteDocumentModelRestApiQuery
- Builder for creating document model adapters for deleting documents using a REST API.
-
DocumentBase<
T> -
Define a document model for storing
Ttypes that inherit from ChangeNotifier. - DocumentModelQuery
- Query class for defining Model.
- DocumentModelRestApiBuilder
- Builder for creating document model adapters using REST APIs.
- DynamicModelInitialCollection
- ModelInitialCollection using DynamicMap.
- DynamicModelInitialDocument
- ModelInitialDocument using DynamicMap.
- GeoValue
- Data to store location information.
- Immutable
- Annotation on an immutable class.
-
ListenableListener<
T extends Listenable> - A widget that monitors changes in Listenable and updates the contents of builder when there is a change.
- LoadDocumentModelRestApiBuilder
- Builder for creating model adapters for loading documents using a REST API.
- LoadDocumentModelRestApiQuery
- Builder for creating model adapters for loading documents using a REST API.
-
LocalizedLocaleValue<
T> - Class for restricting the types of values that can be stored in LocalizedValue.
-
LocalizedValue<
T> - Class for storing translation data.
- ModelAccessQuery
- Stores information for accessing the server.
- ModelAdapter
- You can implement adapters that define the internal specifications of the model.
- ModelAdapterCollectionQuery
- Query class to be passed when executing each function of ModelAdapter.
- ModelAdapterDocumentQuery
- Query class to be passed when executing each function of ModelAdapter.
- ModelAdapterScope
- Widget for setting ModelAdapter.
-
ModelAggregateQuery<
TValue extends AsyncAggregateValue> - A query to output an aggregate of the documents in a collection.
-
ModelBatchCollectionBuilder<
TModel extends DocumentBase> - Builder for batch processing.
-
ModelBatchDocument<
T> - Documentation class for batch.
-
ModelBatchDocumentBuilder<
T> - Builder for batch processing.
- ModelBatchRef
- Reference class for batching.
- ModelCounter
- Define the field as a counter.
- ModelCounterConverter
- ModelFieldValueConverter to enable automatic conversion of ModelCounter as ModelFieldValue.
- ModelCounterFilter
- Filter class to make ModelCounter available to ModelQuery.filters.
- ModelDate
- Define the field as a date.
- ModelDateConverter
- ModelFieldValueConverter to enable automatic conversion of ModelDate as ModelFieldValue.
- ModelDateFilter
- Filter class to make ModelDate available to ModelQuery.filters.
- ModelDateRange
- Define the field as a range of dates.
- ModelDateRangeConverter
- ModelFieldValueConverter to enable automatic conversion of ModelDateRange as ModelFieldValue.
- ModelDateRangeFilter
- Filter class to make ModelDateRange available to ModelQuery.filters.
-
ModelFieldValue<
T> - Class for defining special field values.
-
ModelFieldValueConverter<
T extends ModelFieldValue> - Use this when registering special classes in ModelFieldValue.
-
ModelFieldValueFilter<
T extends ModelFieldValue> - Adapter class for determining the behavior of ModelFieldValue in ModelQuery.filters.
- ModelGeoValue
- Define a model GeoValue that stores location information.
- ModelGeoValueConverter
- ModelFieldValueConverter to enable automatic conversion of ModelGeoValue as ModelFieldValue.
- ModelGeoValueFilter
- Filter class to make ModelGeoValue available to ModelQuery.filters.
- ModelImageUri
- Define the field as an image URI.
- ModelImageUriConverter
- ModelFieldValueConverter to enable automatic conversion of ModelImageUri as ModelFieldValue.
- ModelImageUriFilter
- Filter class to make ModelImageUri available to ModelQuery.filters.
-
ModelInitialCollection<
T> -
Data to be passed to
dataof various ModelAdapter. -
ModelInitialDocument<
T> -
Data to be passed to
dataof various ModelAdapter. -
ModelInitialValue<
T> -
Base class for data to be passed to various ModelAdapter
data. - ModelLocale
- Define a model Locale that stores the locale.
- ModelLocaleConverter
- ModelFieldValueConverter to enable automatic conversion of ModelLocale as ModelFieldValue.
- ModelLocaleFilter
- Filter class to make ModelLocale available to ModelQuery.filters.
- ModelLocalizedValue
- Define a model LocalizedValue that stores locale and text pairs.
- ModelLocalizedValueConverter
- ModelFieldValueConverter to enable automatic conversion of ModelLocalizedValue as ModelFieldValue.
- ModelLocalizedValueFilter
- Filter class to make ModelLocalizedValue available to ModelQuery.filters.
- ModelQuery
- Query class for defining Model.
- ModelQueryFilter
- Definition class for filtering data.
-
ModelRefBase<
T> - Class for defining relationships between models.
-
ModelRefBuilder<
TSource, TResult> - Builder for granting relationships between models and loading data.
-
ModelRefBuilderBase<
TSource> - Base class for defining ModelRefBuilder.
- ModelRefConverter
- ModelFieldValueConverter to enable automatic conversion of ModelRefBase as ModelFieldValue.
-
ModelRefDocumentBase<
T> - Define a document base including ModelRefBase and DocumentBase.
- ModelRefFilter
- Filter class to make ModelRefBase available to ModelQuery.filters.
-
ModelRefListBuilder<
TSource, TResult> - Builder for granting relationships between models and loading data.
-
ModelRefMapBuilder<
TSource, TResult> - Builder for granting relationships between models and loading data.
-
ModelRefPath<
T> - Class for generating ModelRefBase by specifying the path.
- ModelRestApiBuilder
- Builder for creating model adapters using REST APIs.
- ModelRestApiQuery
- Builder for creating model adapters using REST APIs.
- ModelSearch
- Define searchable fields.
- ModelSearchConverter
- ModelFieldValueConverter to enable automatic conversion of ModelSearch as ModelFieldValue.
- ModelSearchFilter
- Filter class to make ModelSearch available to ModelQuery.filters.
- ModelServerCommandBase
- Define commands to work with the server.
- ModelServerCommandBaseConverter
- ModelFieldValueConverter to enable automatic conversion of ModelServerCommandBase as ModelFieldValue.
- ModelServerCommandBaseFilter
- Filter class to make ModelServerCommandBase available to ModelQuery.filters.
- ModelServerCommandCondition
- Condition class used in ModelServerCommandBase.
- ModelServerCommandField
- Field specification class used in ModelServerCommandBase.
- ModelTime
- Define the field as a time.
- ModelTimeConverter
- ModelFieldValueConverter to enable automatic conversion of ModelTime as ModelFieldValue.
- ModelTimeFilter
- Filter class to make ModelTime available to ModelQuery.filters.
- ModelTimeRange
- Define the field as a time range.
- ModelTimeRangeConverter
- ModelFieldValueConverter to enable automatic conversion of ModelTimeRange as ModelFieldValue.
- ModelTimeRangeFilter
- Filter class to make ModelTime available to ModelQuery.filters.
- ModelTimestamp
- Define the field as a timestamp.
- ModelTimestampConverter
- ModelFieldValueConverter to enable automatic conversion of ModelTimestamp as ModelFieldValue.
- ModelTimestampFilter
- Filter class to make ModelTimestamp available to ModelQuery.filters.
- ModelTimestampRange
- Define the field as a range of timestamps.
- ModelTimestampRangeConverter
- ModelFieldValueConverter to enable automatic conversion of ModelTimestampRange as ModelFieldValue.
- ModelTimestampRangeFilter
- Filter class to make ModelTimestampRange available to ModelQuery.filters.
- ModelToken
- Class for storing multiple tokens.
- ModelTokenConverter
- ModelFieldValueConverter to enable automatic conversion of ModelToken as ModelFieldValue.
- ModelTokenFilter
- Filter class to make ModelToken available to ModelQuery.filters.
-
ModelTransactionCollectionBuilder<
TModel extends DocumentBase> - Builder for transactions.
-
ModelTransactionDocument<
T> - Document class for transactions.
-
ModelTransactionDocumentBuilder<
T> - Builder for transactions.
- ModelTransactionRef
- Reference class for performing transactions.
- ModelUpdateNotification
- This class contains data for change notifications.
- ModelUri
- Define the field as a URI.
- ModelUriConverter
- ModelFieldValueConverter to enable automatic conversion of ModelUri as ModelFieldValue.
- ModelUriFilter
- Filter class to make ModelUri available to ModelQuery.filters.
- ModelValidationQuery
- Define the validation query to be used by DatabaseValidator.
- ModelVectorValue
- ModelFieldValue for storing vector embeddings.
- ModelVectorValueConverter
- ModelFieldValueConverter to enable automatic conversion of ModelVectorValue as ModelFieldValue.
- ModelVectorValueFilter
- Filter class to make ModelVectorValue available to ModelQuery.filters.
- ModelVideoUri
- Define the field as a video URI.
- ModelVideoUriConverter
- ModelFieldValueConverter to enable automatic conversion of ModelVideoUri as ModelFieldValue.
- ModelVideoUriFilter
- Filter class to make ModelVideoUri available to ModelQuery.filters.
- NoSqlDatabase
- Class for building a NoSql database model within an application.
-
NumRange<
TNum extends num> - A class that represents a range of numbers.
- PassVectorConverter
- A converter that passes data through without performing any conversion.
-
RectRange<
TNum extends num> - A class that represents a range of numbers.
- RestApiModelAdapter
- Defines ModelAdapter to define builders and make them work accordingly.
- RuntimeModelAdapter
- Model adapter that uses a database that runs only in the memory of the application. All data will be reset when the application is re-launched.
- RuntimeModelBatchRef
- ModelBatchRef for RuntimeModelAdapter.
- RuntimeModelTransactionRef
- ModelTransactionRef for RuntimeModelAdapter.
- RuntimeVectorConverter
- A converter for easy, runtime vector conversion.
- SaveDocumentModelRestApiBuilder
- Builder for creating document model adapters for saving documents using a REST API.
- SaveDocumentModelRestApiQuery
- Builder for creating document model adapters for saving documents using a REST API.
- SyncedVectorConverter
- A synchronous vector value converter.
- TestModelAdapterScope
- Test scope for ModelAdapter.
- VectorConverter
- A vector value converter.
- VectorValue
- Value for storing vector embeddings in models.
Enums
- ApiMethod
- An HTTP method.
- ApiMultipartFileType
- The type of the multipart file.
- DayOfWeek
- Day of the week.
- ModelAccessQueryType
- Define the type of access to the server.
- ModelAggregateQueryType
- Query type for outputting an aggregate of the documents in a collection.
- ModelFieldValueSource
- Defines where the source of the ModelFieldValue is located.
- ModelQueryFilterType
- Define the filter type for ModelQuery.
- ModelUpdateNotificationStatus
- Defines the change status of each model.
- ModelValidationQueryPermissionType
- Specifies the permission type for validation.
- ModelValidationQueryUserType
- Specify the target user for which you want to specify ModelValidationQueryPermissionType.
- VectorDistanceMeasure
- Distance measure for vector similarity calculations.
- VectorValueStoreType
- Types of vector value storage.
Mixins
-
ModelFieldValueAsMapMixin<
T> - Mix-in to allow Json serialization and deserialization of ModelFieldValue.
-
ModelRefLoaderMixin<
T> - It is available by mixing in when using ModelRefBase in DocumentBase.value.
-
ModelRefMixin<
T> - A mix-in to define that it is a relationship between models in DocumentBase, etc.
-
SearchableCollectionMixin<
TModel extends SearchableDocumentMixin> - Mix-ins to create collections for which search functions are available.
-
SearchableDocumentMixin<
T> - Mix-in to make documents searchable.
-
SearchableInitialCollectionMixin<
T> - Mix-in to search for ModelInitialCollection.
-
VectorCollectionMixin<
TModel extends VectorDocumentMixin> - A mixin for creating collections that enable vector-based similarity search.
-
VectorDocumentMixin<
T> - A mixin for making documents searchable by similarity.
-
VectorInitialCollectionMixin<
T> - A mixin for enabling similarity search on ModelInitialCollection.
Extensions
- BooleanExtensions on bool
- Provides extended methods for bool.
- ClockExtensions on Clock
- Provides extended methods for Clock.
-
ClockIterableExtensions
on Iterable<
Clock> - Provides extended methods for Clock arrays.
- DateTimeExtensions on DateTime
- Provides extended methods for DateTime.
-
DateTimeIterableExtensions
on Iterable<
DateTime> - Provides extended methods for DateTime arrays.
- DoubleExtensions on double
- Provides extended methods for double.
-
DoubleIterableExtensions
on Iterable<
double> - Provides extended methods for double arrays.
- DurationExtensions on Duration
- Provides extended methods for Duration.
- DynamicListModelExtensions on DynamicList
- Extension methods for DynamicList.
-
DynamicMapExtensions
on Map<
String, dynamic> - Provides extended methods for DynamicMap.
- DynamicMapModelExtensions on DynamicMap
- Extension methods for DynamicMap.
- DynamicMapModelFieldValueExtensions on DynamicMap
- Provides extension methods for DynamicMap for ModelFieldValue.
-
InterableOfIterableExtensions
on Iterable<
Iterable< T> > - Provides extended methods for Iterable arrays.
- IntExtensions on int
- Provides extended methods for int.
-
IntIterableExtensions
on Iterable<
int> - Provides extended methods for int arrays.
-
IterableExtensions
on Iterable<
T> -
Provides extended methods for
Tarrays. - JsonDynamicListExtensions on DynamicList
- Provides Json extension methods for DynamicList.
- JsonDynamicMapExtensions on DynamicMap
- Provides Json extension methods for DynamicMap.
-
ListenableIterableExtensions
on Iterable<
T> - Provides an extension method for Iterable that includes Listenable as an element.
-
ListExtensions
on List<
T> -
Provides extended methods for List in
T. -
MapExtensions
on Map<
K, V> - Provides extended methods for Map.
-
ModelQueryFilterListExtension
on List<
ModelQueryFilter> - Extension method for a list of ModelQueryFilter.
- ModelStringExtensions on String
- Extension methods for String.
- NullableDoubleExtensions on double?
- Provides an extension method for double that is nullable.
- NullableIntExtensions on int?
- Provides an extension method for int that is nullable.
-
NullableIterableExtensions
on Iterable<
T> ? - Provides an extension method for Iterable that is nullable.
-
NullableListExtensions
on List<
T> ? - Provides an extension method for List that is nullable.
-
NullableMapExtensions
on Map<
K, V> ? - Provides an extension method for Map that is nullable.
- NullableNumExtensions on num?
- Provides an extension method for num that is nullable.
- NullableObjectExtensions on Object?
- Provides an extension method for List that is nullable.
-
NullableSetExtensions
on Set<
T> ? - Provides an extension method for Set that is nullable.
- NullableStringExtensions on String?
- Provides an extension method for String that is nullable.
- NullableTExtensions on T?
-
Provides an extension method for
T?that is nullable. - NullableUriExtensions on Uri?
- Provides an extension method for Uri that is nullable.
-
NullableValueIterableExtensions
on Iterable<
T?> - Provides an extension method for Iterable whose value is nullable.
- RandomExtensions on Random
- Provides extended methods for Random.
-
SetExtensions
on Set<
T> - Provides extended methods for Set.
- StringExtensions on String
- Provides extended methods for String.
- UriExtensions on Uri
- Provides extended methods for Uri.
Constants
- katanaModelLoadTracePrefix → const String
- Prefix used for model loading performance traces.
- kDefaultSearchableFieldKey → const String
- Default field key to form a searchable field.
- kTimeFieldKey → const String
- Field key to store the document update time.
- kTypeFieldKey → const String
- Field key to save the type of the special object in the field.
- kUidFieldKey → const String
-
Field key to store the last part of the document path (
dddfor aaa/bbb/ccc/ddd). - nullOfBool → const bool?
-
A
nullobject with a defined type of bool? - nullOfDouble → const double?
-
A
nullobject with a defined type of double? - nullOfDynamicList → const DynamicList?
-
A
nullobject with a defined type of DynamicList? - nullOfDynamicMap → const DynamicMap?
-
A
nullobject with a defined type of DynamicMap? - nullOfInt → const int?
-
A
nullobject with a defined type of int? - nullOfNum → const num?
-
A
nullobject with a defined type of num? - nullOfString → const String?
-
A
nullobject with a defined type of String? - zeroOfNum → const num
-
A
0object with a defined type of num?
Properties
- sprintf ↔ PrintFormat
-
getter/setter pair
Functions
-
generateCode(
int length, {int seed = 0, String charSet = "23456789abcdefghjkmnpqrstuvwxy"}) → String -
Generates and returns a random string with the number of characters given by
length. -
initializeDateFormatting(
[String? locale, String? ignored]) → Future< void> -
This should be called for at least one
localebefore any date formatting methods are called. It sets up the lookup for date symbols. Both thelocaleandignoredparameter are ignored, as the data for all locales is directly available. -
jsonDecodeAsList<
T extends Object?> (String json, [List< T> defaultValue = const []]) → List<T> -
Converts
jsonto a Json-decoded List<dynamic> object. -
jsonDecodeAsMap<
T extends Object?> (String json, [Map< String, T> defaultValue = const {}]) → Map<String, T> -
Converts
jsonto a Json-decoded Map<String, dynamic> object. -
jsonEncodable(
Object? o) → bool -
If this object is Json encodable,
trueis returned. -
nullOfList<
T> () → List< T> ? -
A
nullobject with a defined type of List<T>? -
nullOfMap<
K, V> () → Map< K, V> ? -
A
nullobject with a defined type of Map<K, V>? -
nullOfSet<
T> () → Set< T> ? -
A
nullobject with a defined type of Set<T>? -
uuid(
{DateTime? baseTime, bool reverse = false}) → String - Generate and retrieve the UUID for Version 7.
-
wait(
Iterable futures) → Future< void> -
Wait until all Futures given in
futuresare completed.
Typedefs
- ApiResponse = Response
- An HTTP response where the entire response body is known in advance.
- ApiResquest = Request
- An HTTP request where the entire request body is known in advance.
- DynamicList = List
- Represents the type of List<dynamic>.
-
DynamicMap
= Map<
String, dynamic> - Represents the type of Map<String, dynamic>.
- ModelQueryFilterCallback = Object? Function(String key, Object? value)
- Callback function for filtering objects.
-
ModelRef<
T> = ModelRefBase< T> ? - Class for defining relationships between models.
Exceptions / Errors
- DatabaseValidationExcepction
- Defines errors during database validation.
- RestApiModelAdapterException
- Exception raised when execution fails.