Realm schema validation failed in flutter sdk

Hi I am a newbie in flutter & realm sdk world , I am stuck here with this error

RealmException: Error opening realm at path /data/data/com.didibusiness/files/mongodb-realm/application-8-kdfbo/644a5089f05fa32952ef3b63/default.realm. Error code: 2016 . Message: Schema validation failed due to the following errors: - Property ‘Documents.documentUrl’ of type ‘array’ has unknown object type ‘documentObject’

@RealmModel()
class _FssaiDocument {
@PrimaryKey()
@MapTo(“_id”)
late ObjectId id;
late ObjectId? userId;
late String applicantEmail; //like shg/ individual
late _ApplicantType? applicantType;
late String? phoneNumber; //phoneNumber of applicant
late int
applicationYears; //number of years for which the application is applied
late int fees;
late _FssaiAddress?
foodPremiseAddress; //address of premise where food is prepared
late List<_Documents> documentList = ; //list of documents for fssai
late List<_ManufacturingProduct> manufacturingProducts = ;
late List statusOfApplication; //based on mital didi & govt
late String? created_date;
late String? expiry_date;
late String? renewal_date;
late List<_PaymentStatus> paymentStatus = ;
late _Downloads? downloads;
late int currentStep = 0;
}

@RealmModel(ObjectType.embeddedObject)
class _Documents {
late String documentName;
late List<_documentObject> documentUrl = ; //document uploaded on S3
late List<_videoWatchedObject> videoWatchedStatus = ;
}

@RealmModel(ObjectType.embeddedObject)
class _videoWatchedObject {
late ObjectId? videoId;
late String? videoStatus;
}

@RealmModel(ObjectType.embeddedObject)
class _documentObject {
late ObjectId id;
late String url;
late String status = “pending with farmdidi”;
late String? error;
}

1 Like
Configuration.flexibleSync(user, [
    ...,
    DocumentObject.schema,
]);

DocumentObject.schema
You forgot to add the embedded object schema in the Configuration.

1 Like

Hey gitesh,
Thank you so much for the explanation ,Indeed I was missing that , sorry for asking such stupid question.

Thank you for helping us noobs.

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.