init method
Initializes the TikiSdk.
The publishingId
is used to connect to TIKI L0 Storage.
A new blockchain address will be defined if no address
provided.
Identification of the origin
is done automatically through the app's
package name, and can be overriden in this method.
Implementation
Future<TikiSdk> init(String publishingId,
{String? address, String? origin, String? databaseDir}) async {
WidgetsFlutterBinding.ensureInitialized();
FlutterKeyStorage keyStorage = FlutterKeyStorage();
WidgetsFlutterBinding.ensureInitialized();
String addr =
await tiki_sdk_dart.TikiSdk.withAddress(keyStorage, address: address);
String dbDir = databaseDir ?? await _dbDir();
Database database = sqlite3.open("$dbDir/$addr.db");
_core = await tiki_sdk_dart.TikiSdk.init(
publishingId,
origin ?? (await PackageInfo.fromPlatform()).packageName,
keyStorage,
addr,
database);
return this;
}