Nathan.fooo df8409178b
refactor: remove singleton db (#4208)
* refactor: remove singleton db

* chore: fix warning

* chore: fix warning

* chore: update test

* chore: only resotre or backup when init call

* test: fix

* test: fix

* test: fix

* fix: timeout notification

* chore: rename

* chore: rename

* chore: disable test

* chore: remove log

* chore: remove log

* chore: add log

* chore: rename test functions

* chore: add test asset

* chore: bump client api

* chore: disable some tests
2023-12-27 11:42:39 +08:00

37 lines
920 B
Dart

export 'package:async/async.dart';
import 'dart:async';
import 'package:appflowy_backend/rust_stream.dart';
import 'package:flutter/services.dart';
import 'dart:ffi';
import 'ffi.dart' as ffi;
import 'package:ffi/ffi.dart';
enum ExceptionType {
AppearanceSettingsIsEmpty,
}
class FlowySDKException implements Exception {
ExceptionType type;
FlowySDKException(this.type);
}
class FlowySDK {
static const MethodChannel _channel = MethodChannel('appflowy_backend');
static Future<String> get platformVersion async {
final String version = await _channel.invokeMethod('getPlatformVersion');
return version;
}
FlowySDK();
Future<void> dispose() async {}
Future<void> init(String configuration) async {
final port = RustStreamReceiver.shared.port;
ffi.set_stream_port(port);
ffi.store_dart_post_cobject(NativeApi.postCObject);
ffi.init_sdk(configuration.toNativeUtf8());
}
}