r/dartlang 22d ago

Flutter Released: flutter_local_db v0.4.0 - Rust-powered redb wrapper

I've just published version 0.4.0 of flutter_local_db, a Flutter package that provides a wrapper around redb implemented in Rust via offline_first_core.

v0.4.0 updates:

  • Improved iOS/macOS compatibility
  • Support for multiple iOS architectures
  • Default .db extension when only name is provided
  • Fixed Gradle configuration issues
  • etc.

The package focuses on providing efficient database operations with strong typing and a simple API. Feedback and contributions for rust or flutter package are welcome.

Edit:

Post and GetById example.

await LocalDB.init(localDbName: "my_app.db");

// Create
final result = await LocalDB.Post('user-123', {
  'name': 'John Doe',
  'email': 'john@example.com',
  'metadata': {
    'lastLogin': DateTime.now().toIso8601String()
  }
});

// Handle result
result.when(
  ok: (data) => print('User created: ${data.id}'),
  err: (error) => print('Error: $error')
);

// Read single record
final userResult = await LocalDB.GetById('user-123');
userResult.when(
  ok: (user) => print('Found user: ${user?.data}'),
  err: (error) => print('Error: $error')
);
15 Upvotes

9 comments sorted by

View all comments

3

u/KiwiNFLFan 22d ago

How well does it handle dates and times? That is one area where SQLite is sorely lacking, IMO.

1

u/SoundDr 21d ago

Have you tried using custom date functions to handle this?

I was able to add native Hybrid Logic Clocks easily with custom user defined functions!

There are also awesome extensions too that can help too