import 'package:realm/realm.dart';
part 'command.realm.dart';
@RealmModel()
class _Command {
@PrimaryKey()
late ObjectId id;
late String command;
late String status;
late DateTime tagab;
}
Hello, I am trying to have a class named UserDatabase that will have a parameter “List commands”. Where the Command class is provided above. After running:dart run realm generate
The Command class was generated successfully. Now I am trying to create the UserDatabase class like this:
import 'package:realm/realm.dart';
import 'command.dart';
part 'user_database.realm.dart';
@RealmModel()
class _UserDatabase {
@PrimaryKey()
late ObjectId id;
late String user_id;
late List<Command> commands;
}
And when running dart run realm generate
, I get this output:
5 │ @RealmModel()
6 │ class _UserDatabase {
│ ━━━━━━━━━━━━━ in realm model for 'UserDatabase'
... │
11 │ late List<Command> commands;
│ ^^^^^^^^^^^^^ List<InvalidType> is not a realm model type
Where am I wrong? Thank you.