Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

type bool bug #474

Closed
goldhan opened this issue Apr 18, 2022 · 8 comments · Fixed by #557
Closed

type bool bug #474

goldhan opened this issue Apr 18, 2022 · 8 comments · Fixed by #557
Assignees

Comments

@goldhan
Copy link

goldhan commented Apr 18, 2022

20220420 Flutter Test

Mac mini (M1)

flutter doctor                                                                                             
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.10.4, on macOS 12.3.1 21E258 darwin-arm, locale zh-Hans-CN)
[✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
[✓] Xcode - develop for iOS and macOS (Xcode 13.3.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.1)
[✓] VS Code (version 1.66.2)
[!] Proxy Configuration
    ! NO_PROXY is not set
[✓] Connected device (3 available)
[!] HTTP Host Availability
    ✗ HTTP host https://cocoapods.org/ is not reachable. Reason: An error occurred while checking the HTTP host: Connection reset by
      peer

! Doctor found issues in 2 categories.

test_demo

The same bug as dart

gif


Hi
ver ^0.2.1+alpha

$ dart --version
Dart SDK version: 2.16.2 (stable) (Tue Mar 22 13:15:13 2022 +0100) on "macos_x64"

Step

  • dart pub add realm_dart
  • dart run realm_dart install

then run

bug

img

code:

realm.write(() {
    /*
      @RealmModel()
class _TestModel {
  @PrimaryKey()
  late int primaryKey = 0;
  bool test1 = true;
  bool test2 = false;
}
    */
    realm.add(TestModel()); // default model
    realm.add(TestModel(primaryKey: 1));
    realm.add(TestModel(test1: false, test2: true, primaryKey: 2));
    realm.add(TestModel(test1: true, test2: false, primaryKey: 3));
  });

type bool

添加进去的数据,和最终取出来的相反
The added data is the opposite of what is finally taken out

code: test1 = false, realm file test1 = true

test_demo

@nielsenko
Copy link
Contributor

nielsenko commented Apr 19, 2022

Hi @goldhan

Thrilled to see you taking Realm for Dart for a spin!

I have opened a PR against you repo (FlutterTrip/issues#1), where I fix cleanRealm and add some asserts to illustrate that the persisted state is sane.

Could I ask you to run again on your end, and forward any assert failures you may see?

Br

@goldhan
Copy link
Author

goldhan commented Apr 19, 2022

Hi @nielsenko
Thank you for your reply

run ... all done!
but ... in Realm Studio
image
so Realm Studio bug ?😳

@nirinchev
Copy link
Member

Are you sure you're looking at the same file that your app is using?

@goldhan
Copy link
Author

goldhan commented Apr 20, 2022

Hi @nirinchev
this file
default.realm
image

@nielsenko
Copy link
Contributor

Hi @goldhan

I can reproduce what you see. I have tested the realm with the .NET SDK as well, which agrees with Realm Studio, so this is a bug in the Dart SDK.

I believe we have an issue regarding mapping of property names to meta-data keys. This would explain why we don't see the issue inside the app, as the mapping is consistent between reads and writes.

This will be fixed before the next release, but I'm not sure exactly when that will land.

Br Kasper

@goldhan
Copy link
Author

goldhan commented Apr 21, 2022

Hi @goldhan

I can reproduce what you see. I have tested the realm with the .NET SDK as well, which agrees with Realm Studio, so this is a bug in the Dart SDK.

I believe we have an issue regarding mapping of property names to meta-data keys. This would explain why we don't see the issue inside the app, as the mapping is consistent between reads and writes.

This will be fixed before the next release, but I'm not sure exactly when that will land.

Br Kasper

Thanks @nielsenko
I'm looking forward to it.
Realm performed great in my project testing. 😃

@nielsenko
Copy link
Contributor

nielsenko commented Apr 21, 2022

You are welcome - and thanks to you for a very precise bug report. It is much appreciated!

@nielsenko
Copy link
Contributor

@goldhan The fix is released with 0.3.0+beta.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants