hive
                                
                                 hive copied to clipboard
                                
                                    hive copied to clipboard
                            
                            
                            
                        Error to use a list : HiveError : To use this list, you have to open the box "empresas" first.
I'm trying to open a box but everytime i try to do that, this Expection happens:
Exception has occurred. HiveError (HiveError: To use this list, you have to open the box "empresas" first.)
The fragment of code that fails is this one:
var boxEmpresas = await Hive.openBox<Empresa>('empresas');
this is the full method:
Future<void> initHive() async {
    await Hive.initFlutter();
    Hive.registerAdapter(EmpresarioAdapter());
    Hive.registerAdapter(EmpresaAdapter());
    var boxEmpresas = await Hive.openBox<Empresa>('empresas');
    var boxEmpresarios = await Hive.openBox<Empresario>('empresarios');
  }
and these are the objects:
import 'package:apiary/objetos/seccion.dart';
import 'package:hive/hive.dart';
import 'package:apiary/objetos/empresario.dart';
part 'empresa.g.dart';
@HiveType(typeId: 1)
class Empresa extends HiveObject {
  @HiveField(0)
  final String id;
  @HiveField(1)
  final String nombre;
  @HiveField(2)
  final Empresario empresario;
  @HiveField(3)
  String password;
  @HiveField(4)
  String? foto;
  @HiveField(5)
  String? descripcion;
  @HiveField(6)
  List<Seccion>? secciones;
  Empresa({
    this.id = '',
    required this.empresario,
    required this.nombre,
    required this.password,
    this.descripcion,
    this.foto,
    this.secciones,
  });
}
import 'package:hive/hive.dart';
import 'package:apiary/objetos/empresa.dart';
part 'empresario.g.dart';
@HiveType(typeId: 0)
class Empresario extends HiveObject {
  @HiveField(0)
  final String id;
  @HiveField(1)
  String? nombre;
  @HiveField(2)
  final String correo;
  @HiveField(3)
  String password;
  @HiveField(4)
  String? telefono;
  @HiveField(5)
  String? foto;
  @HiveField(6)
  List<Empresa>? empresas;
  Empresario({
    this.id = '',
    this.nombre,
    required this.correo,
    required this.password,
    this.telefono,
    this.foto,
    this.empresas,
  });
}
I've been trying to open the 'empresas' box on different parts of the code but none of them worked, even tried to wipe all the data out and got nothing too.