Nathan.fooo 37f269b08b
Chore/rename flowy sdk (#1679)
* chore: run flutter create on flowy_sdk

* chore: rename flowy-sdk to flowy-core

* chore: rename flowy_sdk to appflowy_backend

* chore: fix windows build

* chore: replace bloctest with test

Co-authored-by: nathan <nathan@appflowy.io>
Co-authored-by: vedon <vedon.fu@gmail.com>
2023-01-08 12:10:53 +08:00

38 lines
918 B
Dart

export 'package:async/async.dart';
import 'dart:io';
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();
void dispose() {}
Future<void> init(Directory sdkDir) async {
final port = RustStreamReceiver.shared.port;
ffi.set_stream_port(port);
ffi.store_dart_post_cobject(NativeApi.postCObject);
ffi.init_sdk(sdkDir.path.toNativeUtf8());
}
}