import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:equatable/equatable.dart'; import 'package:hive/hive.dart'; import 'package:selfprivacy/logic/config.dart'; export 'package:provider/provider.dart'; import 'package:equatable/equatable.dart'; part 'appsettingsstate.dart'; class AppSettingsCubit extends Cubit { AppSettingsCubit({ required final String key, }) : super( AppSettingsState( key: key, ), ); Box box = Hive.box(BNames.appSettingsBox); void load() { final String? key = box.get(BNames.serverKey); emit( state.copyWith( key: key, ), ); } void updateServerKey({required final String key}) { box.put(BNames.serverKey, key); emit(state.copyWith(key: key)); } }