A class to make it easier to use Realm in Flutter. Under Development. Currently only available for disconnected mode.
flutter pub add realm_db
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await DB.instance.init();
runApp(const MyApp());
}
DB.instance.get<Product>(
query: "",
arguments: [],
) as RealmResults<Product>
DB.instance.snapshot<Product>(
query: query,
arguments: arguments,
)
DB.instance.add<Product>(item)
DB.instance.update<Product>(item, (current, item) {
current.productName = item.productName;
current.price = item.price;
})
DB.instance.delete<Product>(item);
DB.instance.deleteAll<Product>();
await AuthService.instance.login(
email: "admin@demo.com",
password: "123456",
);
await AuthService.instance.logout();
await AuthService.instance.isLoggedIn();
await AuthService.instance.register(
email: "admin@demo.com",
password: "123456",
);