AndromedaHelix
AndromedaHelix

Reputation: 46

Schema validation failed: property ‘MatchFormSettingsSchema.questionsArray’ of type ‘array’ has unknown object type ‘Question’

I'm trying to setup sync with a new Schema called MatchFormSettingsSchema. This is the code for that schema:

@RealmModel()
class _MatchFormSettingsSchema {
  @PrimaryKey()
  @MapTo('_id')
  late ObjectId id;

  late List<_Question> questionsArray;
}


@RealmModel(ObjectType.embeddedObject)
class _Question {
  late String input;

  late String type;
}

However when initializing my flutter App I get this error while creating my Realm Object:


  final appConfig = AppConfiguration(appID);
  final app = App(appConfig);

  final user = await app.logIn(Credentials.anonymous());
  final realmConfig = Configuration.flexibleSync(
    user,
    [
      MatchSchema.schema,
      MatchFormSettingsSchema.schema,

    ],
  );

  late Realm realm;
  if (await isDeviceOnline()) {
    realm = await Realm.open(realmConfig);
  } else {
    realm = Realm(realmConfig);
  }

Error:

Exception has occurred.
RealmException: Message: Schema validation failed due to the following errors:
- Property 'MatchFormSettingsSchema.questionsArray' of type 'array' has unknown object type 'Question')

I'm going crazy trying to find the issue. I find no errors in Flutter, and no errors in Atlas Sync.

Thanks for helping!

Upvotes: 1

Views: 103

Answers (0)

Related Questions