1 / 1
Nov 2024

Hi, iam building a app using realm and recently iam receiving a strange error.

i changed the schema, added some properties, changed others, and everything was fine, until i try to run it on a actual device.

in the actual device, when i run it in debug mode, works normally, but when i try to run in release mode, or via apk i receive the folowing error:

I/flutter (25139): - Property 'Task.page' has been removed. I/flutter (25139): - Property 'Task.pagekId' has been added.. Error code: realm_errno.RLM_ERR_SCHEMA_MISMATCH.. See for more details.https://www.mongodb.com/docs/realm/sdk/flutter/realm-database/model-data/update-realm-object-schema/#manually-migrate-schema

This doesnt make sense to me, since iam not updating, iam fresh installing, no cache.
and why only works on debug mode?

even not making sense, i tried to migrate, adding things like

var config = Configuration.local([Task.schema],schemaVersion:2,shouldDeleteIfMigrationNeeded: true,); realm = Realm(config);

or even:

var config = Configuration.local([Task.schema],schemaVersion:2,shouldDeleteIfMigrationNeeded:true, migrationCallback:(migration,oldSchemaVersion) { final oldTasks = migration.oldRealm.all('Task'); for (final oldTask in oldTasks) { final newTask = migration.findInNewRealm<Task>(oldTask); if (newTask == null) { // That person must have been deleted, so nothing to do. continue; } newTask.pageId = Uuid.v6(); } },); realm = Realm(config);

it changes the error,but never works on release, sometimes says:

Realm at path *** already opened with a different schema mode

not sure what to do, someone can help?