realm / realm-dart

Realm is a mobile database: a replacement for SQLite & ORMs.
Apache License 2.0
772 stars 86 forks source link

realm_dart-3.4.0/lib/src/handles/native/init.dart:155:12: Error: Method not found: 'DBRef'. #1778

Closed Bilonik closed 3 months ago

Bilonik commented 3 months ago

What happened?

Cant run Realm 3.4.0

I think is missing the new ejson package.

Repro steps

  1. Download the new Release 3.4.0 and run.

Version

3.24

What Atlas Services are you using?

Atlas Device Sync

What type of application is this?

Flutter Application

Client OS and version

iOS 17

Code snippets

No response

Stacktrace of the exception/crash you're getting

Launching lib/main.dart on iPad Pro 13-inch (M4) in debug mode...
Running Xcode build...                                                  
Xcode build done.                                           17.2s
Failed to build iOS app
Error (Xcode): ../../../.pub-cache/hosted/pub.dev/realm_dart-3.4.0/lib/src/handles/native/init.dart:155:12: Error: Method not found: 'DBRef'.

Could not build the application for the simulator.
Error launching application on iPad Pro 13-inch (M4).

Relevant log output

No response

sync-by-unito[bot] commented 3 months ago

➤ PM Bot commented:

Jira ticket: RDART-1089

Bilonik commented 3 months ago

Workaround:

dependency_overrides: ejson: git: url: https://github.com/realm/realm-dart ref: main path: packages/ejson

mniyaz commented 3 months ago

Workaround:

dependency_overrides: ejson: git: url: https://github.com/realm/realm-dart ref: main path: packages/ejson

can you help how to do this. I dont understand

SPodjasek commented 3 months ago

@mniyaz just put lines shown above to your pubspec.yaml:

dependency_overrides:
  ejson:
    git:
      url: https://github.com/realm/realm-dart
      ref: main
      path: packages/ejson

and run flutter pub get afterwards.

nielsenko commented 3 months ago

@mniyaz You need to update your pubspec.yaml with the suggested _dependecyoverride

dependency_overrides:
  ejson:
    git:
      url: https://github.com/realm/realm-dart
      ref: main
      path: packages/ejson

Alternatively you can pin realm to 3.3.0 until this mess is sorted out.

The reason this is happening is that realm 3.4.0 was released without ejson 0.4.0 being released. The ejson packages are still pre 1.0, and one of the things still outstanding is that the github action workflow for publishing (publish-release.yml) doesn't include them yet.

TimotejKovac commented 3 months ago

Just pining realm to 3.3.0 using

dependencies:
  realm: '3.3.0'

is insufficient. I also had to do

dependency_overrides:
  realm_common: '3.3.0'
  realm_dart: '3.3.0'
  realm_generator: '3.3.0'

otherwise these were resolved to their latest versions (3.4.0) in pubspec.lock. Not sure if this is required but still leaving it here if someone will have the same issue.

nielsenko commented 3 months ago

This will be fixed shortly in 3.4.1.