Ein Swift-inspiriertes Lösung für die dauerhafte Datenverwaltung in Flutter. Bietet eine einfache, leistungsstarke und typensichere Möglichkeit, Ihre App-Modelle mit automatischen UI-Aktualisierungen dauerhaft zu speichern.
Aus öffentlichen Paketdaten erstellte Orientierung.
Cozy Data ist ein Flutter-Paket, das von der Datenverwaltungsweise von Swift inspiriert ist und eine typensichere und intuitive Möglichkeit bietet, App-Modelle mit SQL dauerhaft zu speichern. Es verarbeitet automatisch Datenbankoperationen und löst Benutzeroberflächenaktualisierungen aus, wenn sich die Daten ändern, wodurch Boilerplate-Code reduziert und die Entwicklungszeit verkürzt wird. Durch seine Einfachheit und Zuverlässigkeit integriert es sich nahtlos in Flutter’s reaktives Framework und ist daher ideal für Anwendungen, die dauerhafte Speicherung mit Echtzeit-Synchronisation der Benutzeroberfläche erfordern.
Anwendungsfälle
Offline-first-Mobile-Anwendungen
Echtzeit-Daten-Synchronisierung
Typsichere Modellpersistenz
Dynamische Formular- und Listenstatusverwaltung
App-Einstellungen und Speicherung von Benutzereinstellungen
Hauptmerkmale
Automatische UI-Updates bei Datenänderung
Typsichere Datenmodellierung
Swift-inspirierte Syntax und Gestaltung
Eingebaute CRUD-Operationen
Nahtlose Integration mit Flutter-Widgets
Geeignet für
Flutter-Entwickler, die einfache Persistenz suchen
Apps mit Offline-Funktionen
Teams, die Code-Sicherheit und Wartbarkeit priorisieren
Projekte mit häufigen Änderungen am Datenmodell
Entwickler, die mit Swift oder ähnlichen deklarativen Mustern vertraut sind
A Swift-inspired persistent data management solution for Flutter. CozyData provides a simple, powerful, and type-safe way to persist your app's models and automatically update your UI when data changes.
final recipe = awaitCozyData.fetcById<Recipe>(persistentModelID: id);
Advanced Usage
The CozyQueryBuilder is a class used to construct complex SQL-like queries in a structured and programmatic way. It allows you to specify various components of a query, such as fields to group by, order by, having clauses, joins, limits, offsets, selected fields, subqueries, table aliases, and where conditions.
final customBuilder = CozyQueryBuilder(
// groupByFields: A list of fields by which the results should be grouped. In this case, it's an empty list, meaning no grouping is applied.
groupByFields: [],
// orderByFields: A list of fields by which the results should be ordered. It's also an empty list here, so no specific ordering is applied.
orderByFields: [],
// Conditions that filter the groups created by the groupBy clause. It's empty, indicating no such conditions.
havingClauses: [],
// joins: A list of join operations to combine rows from two or more tables based on a related column. No joins are specified here
joins: [],
// limit: The maximum number of records to return. Here, it's set to 10.
limit: 10,
// offset: The number of records to skip before starting to return records. It's set to 0, meaning no records are skipped.
offset: 0,
// selectFields: A list of fields to be selected in the query. It's empty, meaning all fields are selected
selectFields: [],
// subqueries: A list of subqueries to be included in the main query. It's empty, indicating no subqueries.
subqueries: [],
// tableAliases: A map of table aliases to be used in the query. It's an empty map here.
tableAliases: {},
// whereGroups: A list of conditions to filter the results. It's empty, meaning no filtering conditions are applied.
whereGroups: [],
);
Sorting and Filtering once
final recipes = awaitCozyData.fetch<Recipe>(customBuilder: customBuilder);
The CozyQueryController manages query operations for a CozyQueryListener. It allows adding where conditions, joins, order by fields, and custom queries to the listener.