ready property

Future<void> get ready

等待数据库初始化完成

Implementation

Future<void> get ready async {
  if (isDatabaseReady && _db != null) {
    return;
  }

  final initFuture = _initFuture;
  if (initFuture == null) {
    throw StateError(
      'RxNetDataBase has not been initialized. Call RxNet.init() first.',
    );
  }

  await initFuture;

  if (!isDatabaseReady || _db == null) {
    throw StateError('RxNetDataBase is not ready.');
  }
}