flutter_boxer_sqflite
Actually I am a dart package :)
A Wrapper of package sqflite, support easy usage on query/insert/update/delete and batch/transaction
Features
- Easy to
save/updateyour variational models without create different struct tables - Easy to transform object between json/map model type using
toJson/fromJson - Easy to get/set
bool,int,double,stringetc from/to database - Offered the cache policy to you: if the request has not yet been returned, the cache will be used first.
How to use
Initialize
````
# Create a boxer instance (generally it's a single instance)
BoxerDatabase boxer = BoxerDatabase(version: version, name: 'database.db');
# Register the tables
boxer.registerTable(BoxTableManager.cacheTableCommon);
boxer.registerTable(BoxTableManager.cacheTableStudents);
# Open the database establish connection
await boxer.open();
````
// Then use the api of table instance such as: get<T>/set<T>/list<T>/query<T>/delete<T> ...
About try-catch
Boxersql api not wrapped bytry-catchblock, so caller should handle exceptions by yourself, upload toSentryetc. But theBoxCacheTablein the example all open api are surroundtry-catchand feel free to use it.Boxercatch some fatal error, so caller can handle these error log using propertieslogger&onFatalErrorofBoxerLogger.
For windows & linux
Just uncomment the codes under `/// For windows & linux` comments, there are 3 occurrences.
More demostrations
Run example/lib/main.dart on mobile device or PC for more example usage.
Features and bugs
Please feel free to: request new features and bugs at the issue tracker
Libraries
- core/boxer_database
- core/boxer_query_option
- core/boxer_table_base
- core/boxer_table_translator
- core/features/boxer_delete_functions
- core/features/boxer_insert_functions
- core/features/boxer_query_functions
- core/features/boxer_update_functions
- flutter_boxer_sqflite
- util/boxer_database_util
- util/boxer_extensions
- util/boxer_loader
- util/boxer_logger
- util/boxer_utils