4

So I'm trying to use moor to create an encrypted database, and use Injectible/GetIt to be able to inject it into other classes.

I have a wrapper class

@Singleton.lazy(signalsReady: true)
class BillingDatabaseModule {
  static BillingDatabase _billingDatabase;

  BillingDatabase get billingDatabase => _billingDatabase;

  @factoryMethod
  static  BillingDatabaseModule billingDatabaseInit(@factoryParam String code) {
    var instance = BillingDatabaseModule();
    _billingDatabase = BillingDatabase(code);
    GetIt.instance.signalReady(instance);
    return instance;
  }
} 

This is causing the folowing error

Injectable Generator ---------------------------------------------------
Error generating [BillingDatabaseModule]! only factories can have parameters
------------------------------------------------------------------------ 

So my problem is I can't open the database until the pin is entered/created since it's the password to the database. So I'm trying to delay opening it until I've created/entred the pin.

My backup option is to create a strong random string and store it using secure storage. I mean I'm already doing that for the pin anyways.

Cate Daniel
  • 724
  • 2
  • 14
  • 30

0 Answers0