bfs_manager 0.0.1
bfs_manager: ^0.0.1 copied to clipboard
A dynamic local SQLite database to server synchronization manager for Flutter applications.
bfs_manager #
A dynamic local SQLite database to server synchronization manager for Flutter applications. It enables offline-first capabilities by queueing local actions and syncing them to a Laravel (or custom) backend automatically.
Features #
- Database Isolation: Sync tasks are stored in an internal isolated SQLite queue database so they don't bloat your main application database.
- Dynamic Operations: Sync inserts, updates, and deletes are executed using raw dynamic SQL, allowing integration with any schema or table dynamically.
- Auto Authentication Caching: Automatically reads and stores Bearer tokens from login/register responses.
- Optional Header Overrides: Easily send extra headers during login or register.
Getting started #
Add bfs_manager to your pubspec.yaml dependencies:
dependencies:
bfs_manager:
path: ../bfs_manager
Usage #
Initialize the synchronization manager:
import 'package:bfs_manager/bfs_manager.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
final appDb = await $FloorAppDatabase.databaseBuilder('app_database.db').build();
await BfsManager.instance.init(
baseUrl: "https://your-domain.com/api",
appDatabase: appDb.database,
);
runApp(const MyApp());
}
Log a local database change to the queue:
await BfsManager.instance.insertLocal(
tableName: "tb_tasks",
status: "insert",
data: task.toJson(),
);
For full documentation and examples, please consult the integration guide.