Import the realm package and call the instance on main.dart.
Then try to call the config method of my code
GetIt.I.registerSingletonAsync<InventoryRealmConfiguration>(
() async {
final inventoryRealmConfiguration = InventoryRealmConfiguration();
await inventoryRealmConfiguration.config();
return InventoryRealmConfiguration();
},
);
It will execute my code, and i got the stacktrace mentioned below.
Version
Flutter version: 3.22.3
What Atlas Services are you using?
Local Database only with the data fetching from my mongodb
What happened?
Did a Setup of realm db in my flutter app.
Repro steps
Import the realm package and call the instance on main.dart. Then try to call the config method of my code
Version
Flutter version: 3.22.3
What Atlas Services are you using?
Local Database only with the data fetching from my mongodb
What type of application is this?
Flutter Application
Client OS and version
realm version 3.4.1 and flutter 3.22.3
Code snippets
import 'package:flutter/material.dart'; import 'package:realm/realm.dart'; import 'package:team_appcommon/team_appcommon.dart'; import 'package:team_inventory/src/common/realm/realm_models/realm_models.dart'; import 'package:team_inventory/src/common/secure_storage/secure_storage_constants.dart';
/// Class to handle the Realm Configuration class RealmConfiguration { late App _app; User? _user;
/// Constructor InventoryRealmConfiguration();
Future config() async {
const appId = "teaminvrealm-xsfakll";
final secureStorageManager = SecureStorageManager();
}
/// Open the realm db Realm openRealm(Configuration config) { return Realm(config); }
/// Method to get inventory data from MongoDB List getInventoryData() {
if (_user == null) throw Exception("User is not logged in");
}
/// Method to get inventory Balance data from MongoDB List getInvBalanceData() {
if (_user == null) throw Exception("User is not logged in");
}
/// Method to get inventory Cost Data from MongoDB List getInvCostData() {
if (_user == null) throw Exception("User is not logged in");
}
/// Method to get inventory Item Data from MongoDB List- getItemData() {
if (_user == null) throw Exception("User is not logged in");
}
/// Method to get inventory Item Data from MongoDB List getInvReserveData() {
if (_user == null) throw Exception("User is not logged in");
} }
Stacktrace of the exception/crash you're getting
Relevant log output