admin管理员组

文章数量:1279243

i follow the migration guide /migration/ but i get this error

    DartError: LateInitializationError: Field '__storage' has not been initialized.
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 307:3  throw_
errors.dart:307
packages/hydrated_bloc/src/hydrated_bloc.dart 107:22                         get [__storage]
hydrated_bloc.dart:107
packages/hydrated_bloc/src/hydrated_bloc.dart 154:19                         onChange
hydrated_bloc.dart:154
packages/bloc/src/bloc_base.dart 103:7                                       emit
bloc_base.dart:103

My code:

Future<void> initServices({String? env}) async {
  WidgetsFlutterBinding.ensureInitialized();
  HydratedBloc.storage = await HydratedStorage.build(
    storageDirectory: kIsWeb
        ? HydratedStorageDirectory.web
        : HydratedStorageDirectory((await getTemporaryDirectory()).path),
  );

  final from = getParams();
  await EnvCubit.instance.init(from.fromBrand, env: env);
}

And

void main() async {
  await initServices(env: 'dev');
  runApp(const MyApp());
}

Thanks for the help!

本文标签: