I am developing a flutter app which uses 2DSphere coordinates in the schema and queries them. I have an index on the coordinates (2dsphere), and the schema and schemas.dart works fine on the iOS simulator and iPhone. When I test on MacOS desktop I get the following exception:
flutter: 2023-06-04T14:00:05.236643: [ERROR] Realm: Connection[1]: Session[1]: Error integrating bootstrap changesets: Failed to transform received changeset: Schema mismatch: Property 'longitude' in class 'Location' is nullable on one side and not on the other.
and of course, they don’t load into the app…
Again, I’m not seeing this under iOS. I’m not sure what changes to schema.dart and/or my realm schema to fix this.
If it helps understand the problem, the location object is embedded in another object, which is also embedded in another object.
Below is the my schema.dart fragment, and app services Schema (running in dev mode), and flutter environment:
// coordianates are LONGITUDE 1st, then LATITUDE
@RealmModel(ObjectType.embeddedObject)
class _Location {
@MapTo('type')
late String type;
@MapTo('coordinates')
late List<double> coordinates;
}
"properties": {
"location": {
"title": "Location",
"type": "object",
"required": [
"type"
],
"properties": {
"coordinates": {
"bsonType": "array",
"items": {
"bsonType": "double"
}
},
"type": {
"bsonType": "string"
}
}
},
"location_id": {
"bsonType": "objectId"
},
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.10.2, on macOS 13.4 22F66 darwin-arm64, locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 14.3)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.2)
[✓] VS Code (version 1.78.2)
[✓] Connected device (3 available)
[✓] Network resources
• No issues found!