realm / realm-dart

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

sane_uuid 1.0.0 breaks ejson build #1729

Closed ubergaijin closed 5 months ago

ubergaijin commented 5 months ago

What happened?

sane_uuid 1.0.0 introduces the following breaking change:

The Uuid.fromBytes factory now accepts a Uint8List instead of a ByteBuffer

and since ejson has the dependency: sane_uuid: ^1.0.0-alpha.5 it now gets resolved to version 1.0.1 with the breaking change and following errors:

../../../../.pub-cache/hosted/pub.dev/ejson-0.3.0/lib/src/decoding.dart:246:92: Error: The argument type 'ByteBuffer' can't be assigned to the parameter type 'Uint8List'.
 - 'ByteBuffer' is from 'dart:typed_data'.
 - 'Uint8List' is from 'dart:typed_data'.
    {'\$binary': {'base64': String s, 'subType': '04'}} => Uuid.fromBytes(base64.decode(s).buffer),

Repro steps

after pub upgrade, compile a program that uses realm/ejson.

Version

3.22.2

What Atlas Services are you using?

Local Database only

What type of application is this?

Flutter Application

Client OS and version

macOs Sonoma 14.5

Code snippets

No response

Stacktrace of the exception/crash you're getting

../../../../.pub-cache/hosted/pub.dev/realm_dart-3.0.0/lib/src/handles/native/from_native.dart:62:59: Error: The argument type 'ByteBuffer' can't be assigned to the parameter type 'Uint8List'.
 - 'ByteBuffer' is from 'dart:typed_data'.
 - 'Uint8List' is from 'dart:typed_data'.
        return Uuid.fromBytes(Uint8List.fromList(listInt).buffer);
                                                          ^

package:test_core/src/runner/vm/platform.dart 242:7   VMPlatform._compileToKernel
===== asynchronous gap ===========================
package:test_core/src/runner/vm/platform.dart 220:13  VMPlatform._spawnIsolate
===== asynchronous gap ===========================
package:test_core/src/runner/vm/platform.dart 75:19   VMPlatform.load
===== asynchronous gap ===========================
package:test_core/src/runner/loader.dart 219:27       Loader.loadFile.<fn>
===== asynchronous gap ===========================
package:test_core/src/runner/load_suite.dart 97:19    new LoadSuite.<fn>.<fn>

Relevant log output

No response

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

➤ PM Bot commented:

Jira ticket: RDART-1059

ubergaijin commented 5 months ago

as a workaround, add this to the pubspec.yaml:

dependency_overrides:
  sane_uuid: 1.0.0-alpha.5
PrestigiousF commented 5 months ago

as a workaround, add this to the pubspec.yaml:

dependency_overrides:
  sane_uuid: 1.0.0-alpha.5

This solved my issue, thank you so much. I thought my project was broken.. I tried so many things, and I was actually in the process of backing up my data to start the entire project over while reviewing this thread lmao.. Thank you!

nielsenko commented 5 months ago

This is fixed with realm 3.1.0