├── .gitattributes ├── packages ├── README.ejson.md ├── ejson │ ├── LICENSE │ ├── README.md │ ├── CHANGELOG.md │ ├── analysis_options.yaml │ ├── lib │ │ ├── ejson.dart │ │ └── src │ │ │ └── configuration.dart │ ├── example │ │ └── main.dart │ └── pubspec.yaml ├── realm │ ├── LICENSE │ ├── README.md │ ├── CHANGELOG.md │ ├── CONTRIBUTING.md │ ├── linux │ │ ├── binary │ │ └── include │ │ │ └── realm │ │ │ └── realm_plugin.h │ ├── windows │ │ ├── binary │ │ └── include │ │ │ └── realm │ │ │ └── realm_plugin.h │ ├── analysis_options.yaml │ ├── dartdoc_options.yaml │ ├── tests │ │ ├── test │ │ │ └── data │ │ ├── analysis_options.yaml │ │ ├── ios │ │ │ ├── Runner │ │ │ │ ├── Runner-Bridging-Header.h │ │ │ │ ├── Assets.xcassets │ │ │ │ │ ├── LaunchImage.imageset │ │ │ │ │ │ ├── LaunchImage.png │ │ │ │ │ │ ├── LaunchImage@2x.png │ │ │ │ │ │ ├── LaunchImage@3x.png │ │ │ │ │ │ ├── README.md │ │ │ │ │ │ └── Contents.json │ │ │ │ │ └── AppIcon.appiconset │ │ │ │ │ │ ├── Icon-App-20x20@1x.png │ │ │ │ │ │ ├── Icon-App-20x20@2x.png │ │ │ │ │ │ ├── Icon-App-20x20@3x.png │ │ │ │ │ │ ├── Icon-App-29x29@1x.png │ │ │ │ │ │ ├── Icon-App-29x29@2x.png │ │ │ │ │ │ ├── Icon-App-29x29@3x.png │ │ │ │ │ │ ├── Icon-App-40x40@1x.png │ │ │ │ │ │ ├── Icon-App-40x40@2x.png │ │ │ │ │ │ ├── Icon-App-40x40@3x.png │ │ │ │ │ │ ├── Icon-App-60x60@2x.png │ │ │ │ │ │ ├── Icon-App-60x60@3x.png │ │ │ │ │ │ ├── Icon-App-76x76@1x.png │ │ │ │ │ │ ├── Icon-App-76x76@2x.png │ │ │ │ │ │ ├── Icon-App-1024x1024@1x.png │ │ │ │ │ │ └── Icon-App-83.5x83.5@2x.png │ │ │ │ └── AppDelegate.swift │ │ │ ├── Flutter │ │ │ │ ├── Debug.xcconfig │ │ │ │ ├── Release.xcconfig │ │ │ │ └── AppFrameworkInfo.plist │ │ │ ├── Runner.xcodeproj │ │ │ │ └── project.xcworkspace │ │ │ │ │ ├── contents.xcworkspacedata │ │ │ │ │ └── xcshareddata │ │ │ │ │ ├── WorkspaceSettings.xcsettings │ │ │ │ │ └── IDEWorkspaceChecks.plist │ │ │ ├── Runner.xcworkspace │ │ │ │ ├── contents.xcworkspacedata │ │ │ │ └── xcshareddata │ │ │ │ │ ├── WorkspaceSettings.xcsettings │ │ │ │ │ └── IDEWorkspaceChecks.plist │ │ │ └── RunnerTests │ │ │ │ └── RunnerTests.swift │ │ ├── build.yaml │ │ ├── android │ │ │ ├── gradle.properties │ │ │ ├── app │ │ │ │ └── src │ │ │ │ │ ├── main │ │ │ │ │ ├── res │ │ │ │ │ │ ├── mipmap-hdpi │ │ │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ │ ├── mipmap-mdpi │ │ │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ │ ├── mipmap-xhdpi │ │ │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ │ ├── drawable │ │ │ │ │ │ │ └── launch_background.xml │ │ │ │ │ │ └── drawable-v21 │ │ │ │ │ │ │ └── launch_background.xml │ │ │ │ │ └── kotlin │ │ │ │ │ │ └── io │ │ │ │ │ │ └── realm │ │ │ │ │ │ └── tests │ │ │ │ │ │ └── MainActivity.kt │ │ │ │ │ ├── debug │ │ │ │ │ └── AndroidManifest.xml │ │ │ │ │ └── profile │ │ │ │ │ └── AndroidManifest.xml │ │ │ ├── gradle │ │ │ │ └── wrapper │ │ │ │ │ └── gradle-wrapper.properties │ │ │ ├── build.gradle │ │ │ └── settings.gradle │ │ ├── macos │ │ │ ├── Runner │ │ │ │ ├── Configs │ │ │ │ │ ├── Debug.xcconfig │ │ │ │ │ ├── Release.xcconfig │ │ │ │ │ ├── Warnings.xcconfig │ │ │ │ │ └── AppInfo.xcconfig │ │ │ │ ├── Assets.xcassets │ │ │ │ │ └── AppIcon.appiconset │ │ │ │ │ │ ├── app_icon_128.png │ │ │ │ │ │ ├── app_icon_16.png │ │ │ │ │ │ ├── app_icon_256.png │ │ │ │ │ │ ├── app_icon_32.png │ │ │ │ │ │ ├── app_icon_512.png │ │ │ │ │ │ ├── app_icon_64.png │ │ │ │ │ │ └── app_icon_1024.png │ │ │ │ ├── AppDelegate.swift │ │ │ │ ├── Release.entitlements │ │ │ │ ├── MainFlutterWindow.swift │ │ │ │ └── DebugProfile.entitlements │ │ │ ├── Flutter │ │ │ │ ├── Flutter-Debug.xcconfig │ │ │ │ ├── Flutter-Release.xcconfig │ │ │ │ └── GeneratedPluginRegistrant.swift │ │ │ ├── Runner.xcworkspace │ │ │ │ ├── contents.xcworkspacedata │ │ │ │ └── xcshareddata │ │ │ │ │ └── IDEWorkspaceChecks.plist │ │ │ ├── Runner.xcodeproj │ │ │ │ └── project.xcworkspace │ │ │ │ │ └── xcshareddata │ │ │ │ │ └── IDEWorkspaceChecks.plist │ │ │ └── RunnerTests │ │ │ │ └── RunnerTests.swift │ │ ├── windows │ │ │ ├── runner │ │ │ │ ├── resources │ │ │ │ │ └── app_icon.ico │ │ │ │ ├── resource.h │ │ │ │ └── utils.h │ │ │ └── flutter │ │ │ │ ├── generated_plugin_registrant.cc │ │ │ │ ├── generated_plugin_registrant.h │ │ │ │ └── generated_plugins.cmake │ │ ├── .gitignore │ │ ├── linux │ │ │ ├── main.cc │ │ │ ├── flutter │ │ │ │ ├── generated_plugin_registrant.h │ │ │ │ ├── generated_plugin_registrant.cc │ │ │ │ └── generated_plugins.cmake │ │ │ └── my_application.h │ │ └── README.md │ ├── android │ │ ├── settings.gradle │ │ ├── src │ │ │ ├── main │ │ │ │ ├── cpp │ │ │ │ │ ├── lib │ │ │ │ │ ├── realm_plugin.cpp │ │ │ │ │ └── CMakeLists.txt │ │ │ │ └── AndroidManifest.xml │ │ │ └── gen │ │ │ │ └── RealmConfig.java │ │ ├── gradle │ │ │ └── wrapper │ │ │ │ ├── gradle-wrapper.jar │ │ │ │ └── gradle-wrapper.properties │ │ └── gradle.properties │ ├── example │ │ ├── analysis_options.yaml │ │ ├── .gitignore │ │ ├── .metadata │ │ ├── pubspec.yaml │ │ └── README.md │ ├── ios │ │ ├── realm_dart.xcframework │ │ ├── Classes │ │ │ ├── realm_plugin.h │ │ │ ├── platform.mm │ │ │ └── RealmPlugin.h │ │ └── Resources │ │ │ └── PrivacyInfo.xcprivacy │ ├── lib │ │ └── realm.dart │ ├── bin │ │ └── realm.dart │ ├── macos │ │ ├── Classes │ │ │ ├── realm_plugin.h │ │ │ └── RealmPlugin.swift │ │ └── Resources │ │ │ └── PrivacyInfo.xcprivacy │ ├── .metadata │ ├── .pubignore │ ├── build.yaml │ └── pubspec.yaml ├── ejson_lint │ ├── LICENSE │ ├── README.md │ ├── CHANGELOG.md │ ├── analysis_options.yaml │ ├── example │ │ ├── CHANGELOG.md │ │ ├── analysis_options.yaml │ │ ├── README.md │ │ ├── dart_dependency_validator.yaml │ │ ├── .gitignore │ │ ├── pubspec.yaml │ │ └── bin │ │ │ └── example.dart │ ├── dart_dependency_validator.yaml │ ├── lib │ │ ├── ejson_lint.dart │ │ └── src │ │ │ └── ejson_lint_base.dart │ └── pubspec.yaml ├── realm_common │ ├── LICENSE │ ├── README.md │ ├── CHANGELOG.md │ ├── CONTRIBUTING.md │ ├── dartdoc_options.yaml │ ├── analysis_options.yaml │ ├── lib │ │ └── realm_common.dart │ └── pubspec.yaml ├── realm_dart │ ├── LICENSE │ ├── README.md │ ├── CHANGELOG.md │ ├── CONTRIBUTING.md │ ├── analysis_options.yaml │ ├── dart_test.yaml │ ├── dartdoc_options.yaml │ ├── dev │ │ ├── CHANGELOG.md │ │ ├── analysis_options.yaml │ │ ├── README.md │ │ ├── bin │ │ │ └── dev.dart │ │ ├── pubspec.yaml │ │ └── lib │ │ │ └── dev.dart │ ├── .gitignore │ ├── example │ │ ├── analysis_options.yaml │ │ └── pubspec.yaml │ ├── lib │ │ ├── src │ │ │ ├── handles │ │ │ │ ├── native │ │ │ │ │ ├── convert_native.dart │ │ │ │ │ ├── ffi.dart │ │ │ │ │ ├── query_handle.dart │ │ │ │ │ └── convert.dart │ │ │ │ ├── web │ │ │ │ │ ├── web_not_supported.dart │ │ │ │ │ ├── default_client.dart │ │ │ │ │ ├── list_handle.dart │ │ │ │ │ ├── map_handle.dart │ │ │ │ │ ├── set_handle.dart │ │ │ │ │ ├── user_handle.dart │ │ │ │ │ ├── object_handle.dart │ │ │ │ │ ├── results_handle.dart │ │ │ │ │ ├── session_handle.dart │ │ │ │ │ ├── map_changes_handle.dart │ │ │ │ │ ├── subscription_handle.dart │ │ │ │ │ ├── object_changes_handle.dart │ │ │ │ │ ├── subscription_set_handle.dart │ │ │ │ │ ├── collection_changes_handle.dart │ │ │ │ │ ├── notification_token_handle.dart │ │ │ │ │ ├── mutable_subscription_set_handle.dart │ │ │ │ │ ├── handle_base.dart │ │ │ │ │ ├── realm_handle.dart │ │ │ │ │ ├── realm_core.dart │ │ │ │ │ ├── scheduler_handle.dart │ │ │ │ │ ├── schema_handle.dart │ │ │ │ │ ├── app_handle.dart │ │ │ │ │ └── async_open_task_handle.dart │ │ │ │ ├── notification_token_handle.dart │ │ │ │ ├── handle_base.dart │ │ │ │ ├── map_changes_handle.dart │ │ │ │ ├── object_changes_handle.dart │ │ │ │ ├── collection_changes_handle.dart │ │ │ │ ├── default_client.dart │ │ │ │ ├── schema_handle.dart │ │ │ │ ├── scheduler_handle.dart │ │ │ │ ├── subscription_handle.dart │ │ │ │ ├── mutable_subscription_set_handle.dart │ │ │ │ ├── async_open_task_handle.dart │ │ │ │ ├── results_handle.dart │ │ │ │ └── subscription_set_handle.dart │ │ │ ├── convert.dart │ │ │ ├── realm_dart.dart │ │ │ ├── realm_flutter.dart │ │ │ ├── realm_web.dart │ │ │ └── cli │ │ │ │ ├── archive │ │ │ │ ├── options.dart │ │ │ │ └── options.g.dart │ │ │ │ ├── extract │ │ │ │ ├── options.dart │ │ │ │ └── options.g.dart │ │ │ │ ├── generate │ │ │ │ └── options.dart │ │ │ │ └── common │ │ │ │ └── target_os_type.dart │ │ └── realm.dart │ ├── test │ │ ├── data │ │ │ └── realm_files │ │ │ │ └── old-format.realm │ │ └── utils │ │ │ ├── web │ │ │ └── platform_util.dart │ │ │ └── platform_util.dart │ ├── bin │ │ └── realm_dart.dart │ ├── scripts │ │ ├── build-linux.sh │ │ ├── build-macos.sh │ │ ├── cmake-build-xcode.sh │ │ ├── build.bat │ │ ├── launch-c.in │ │ ├── launch-cxx.in │ │ └── build-android.bat │ ├── .pubignore │ ├── src │ │ └── dart-dl │ │ │ ├── CMakeLists.txt │ │ │ ├── dart_version.h │ │ │ └── internal │ │ │ └── dart_api_dl_impl.h │ └── build.yaml ├── ejson_analyzer │ ├── LICENSE │ ├── README.md │ ├── CHANGELOG.md │ ├── analysis_options.yaml │ ├── lib │ │ ├── ejson_analyzer.dart │ │ └── src │ │ │ └── ejson_analyzer_base.dart │ └── pubspec.yaml ├── ejson_annotation │ ├── LICENSE │ ├── README.md │ ├── CHANGELOG.md │ ├── analysis_options.yaml │ ├── pubspec.yaml │ └── lib │ │ └── ejson_annotation.dart ├── ejson_generator │ ├── LICENSE │ ├── README.md │ ├── CHANGELOG.md │ ├── analysis_options.yaml │ ├── lib │ │ ├── ejson_generator.dart │ │ └── src │ │ │ └── builder.dart │ ├── build.yaml │ └── pubspec.yaml ├── realm_generator │ ├── LICENSE │ ├── README.md │ ├── CHANGELOG.md │ ├── CONTRIBUTING.md │ ├── analysis_options.yaml │ ├── dartdoc_options.yaml │ ├── .pubignore │ ├── test │ │ ├── good_test_data │ │ │ ├── all_named_ctor.realm.dart │ │ │ ├── pinhole.dart │ │ │ ├── optional_argument.dart │ │ │ ├── required_argument.dart │ │ │ ├── required_argument_with_default_value.dart │ │ │ ├── map.realm.dart │ │ │ ├── mapto.realm.dart │ │ │ ├── pinhole.realm.dart │ │ │ ├── all_types.realm.dart │ │ │ ├── binary_type.realm.dart │ │ │ ├── primary_key.realm.dart │ │ │ ├── realm_set.realm.dart │ │ │ ├── another_mapto.realm.dart │ │ │ ├── embedded_objects.realm.dart │ │ │ ├── indexable_types.realm.dart │ │ │ ├── asymmetric_object.realm.dart │ │ │ ├── const_initializer.realm.dart │ │ │ ├── optional_argument.realm.dart │ │ │ ├── private_fields.realm.dart │ │ │ ├── required_argument.realm.dart │ │ │ ├── embedded_annotations.realm.dart │ │ │ ├── list_initialization.realm.dart │ │ │ ├── user_defined_getter.realm.dart │ │ │ ├── binary_type.dart │ │ │ ├── user_defined_getter.dart │ │ │ ├── required_argument_with_default_value.realm.dart │ │ │ ├── another_mapto.dart │ │ │ ├── private_fields.dart │ │ │ ├── all_named_ctor.dart │ │ │ ├── mapto.dart │ │ │ ├── asymmetric_object.dart │ │ │ ├── list_initialization.dart │ │ │ ├── embedded_annotations.dart │ │ │ ├── map.dart │ │ │ ├── primary_key.dart │ │ │ └── realm_set.dart │ │ ├── error_test_data │ │ │ ├── backlink_annotation_on_incompatible_field.dart │ │ │ ├── fts_index_wrong_type.dart │ │ │ ├── backlink_annotation_on_invalid_iterable.dart │ │ │ ├── nullable_realm_value.dart │ │ │ ├── map_unsupported.dart │ │ │ ├── realm_value_not_allowed_as_primary_key.dart │ │ │ ├── asymmetric_wrong_pk.dart │ │ │ ├── invalid_model_name_prefix.dart │ │ │ ├── repeated_class_annotations.dart │ │ │ ├── date_primary_key.dart │ │ │ ├── asymmetric_missing_pk.dart │ │ │ ├── defining_both_class_prefixes.dart │ │ │ ├── nullable_set.dart │ │ │ ├── not_a_realm_type.dart │ │ │ ├── not_an_indexable_type.dart │ │ │ ├── nullable_list.dart │ │ │ ├── const_initializer.dart │ │ │ ├── set_non_empty_initializer.dart │ │ │ ├── illigal_constructor.dart │ │ │ ├── invalid_extend.dart │ │ │ ├── invalid_extend.expected │ │ │ ├── list_non_empty_initializer.dart │ │ │ ├── long_class_name.dart │ │ │ ├── dict_non_empty_initializer.dart │ │ │ ├── embedded_object_primary_key.dart │ │ │ ├── nullable_list.realm.dart │ │ │ ├── nullable_set.realm.dart │ │ │ ├── bool_not_allowed_as_primary_key.dart │ │ │ ├── invalid_extend.realm.dart │ │ │ ├── long_class_name.realm.dart │ │ │ ├── map_unsupported.realm.dart │ │ │ ├── const_initializer.realm.dart │ │ │ ├── date_primary_key.realm.dart │ │ │ ├── double_primary_key.realm.dart │ │ │ ├── missing_underscore.realm.dart │ │ │ ├── not_a_realm_type.realm.dart │ │ │ ├── fts_index_wrong_type.realm.dart │ │ │ ├── illigal_constructor.realm.dart │ │ │ ├── list_of_list_not_supported.dart │ │ │ ├── long_mapped_to_name.realm.dart │ │ │ ├── nullable_realm_value.realm.dart │ │ │ ├── repeated_field_annotations.dart │ │ │ ├── backlink_illegal_symbol.realm.dart │ │ │ ├── backlink_unknown_symbol.realm.dart │ │ │ ├── not_an_indexable_type.realm.dart │ │ │ ├── nullable_list_elements.realm.dart │ │ │ ├── backlink_unknown_symbol.dart │ │ │ ├── invalid_model_name_prefix.realm.dart │ │ │ ├── long_mapped_to_name.dart │ │ │ ├── backlink_illegal_symbol.dart │ │ │ ├── backlink_incompatible_type.realm.dart │ │ │ ├── defining_both_class_prefixes.realm.dart │ │ │ ├── embedded_object_primary_key.realm.dart │ │ │ ├── list_of_list_not_supported.realm.dart │ │ │ ├── repeated_class_annotations.realm.dart │ │ │ ├── repeated_field_annotations.realm.dart │ │ │ ├── unsupported_non_realm_type_set.dart │ │ │ ├── unsupported_non_realm_type_set.realm.dart │ │ │ ├── bool_not_allowed_as_primary_key.realm.dart │ │ │ ├── non_nullable_realm_object_reference.realm.dart │ │ │ ├── realm_object_reference_default_values.realm.dart │ │ │ ├── realm_value_not_allowed_as_primary_key.realm.dart │ │ │ ├── unsupported_realm_set_of_nullable_realmobject.dart │ │ │ ├── asymmetric_external_link.dart │ │ │ ├── backlink_annotation_on_invalid_iterable.realm.dart │ │ │ ├── missing_underscore.dart │ │ │ ├── unsupported_realm_set_of_nullable_realmvalue.dart │ │ │ ├── unsupported_realm_set_with_default_values.dart │ │ │ ├── backlink_annotation_on_incompatible_field.realm.dart │ │ │ ├── nullable_set.expected │ │ │ ├── unsupported_realm_set_with_default_values.realm.dart │ │ │ ├── invalid_model_name_prefix.expected │ │ │ ├── nullable_list.expected │ │ │ ├── unsupported_realm_set_of_nullable_realmobject.realm.dart │ │ │ ├── unsupported_realm_set_of_nullable_realmvalue.realm.dart │ │ │ ├── non_nullable_realm_object_reference.dart │ │ │ ├── asymmetric_missing_pk.expected │ │ │ ├── nullable_list_elements.dart │ │ │ ├── realm_object_reference_default_values.dart │ │ │ ├── double_primary_key.dart │ │ │ ├── backlink_incompatible_type.dart │ │ │ ├── asymmetric_external_link.expected │ │ │ ├── illigal_constructor.expected │ │ │ ├── repeated_class_annotations.expected │ │ │ ├── const_initializer.expected │ │ │ ├── non_nullable_realm_object_reference.expected │ │ │ ├── backlink_annotation_on_incompatible_field.expected │ │ │ ├── map_unsupported.expected │ │ │ ├── nullable_realm_value.expected │ │ │ ├── backlink_annotation_on_invalid_iterable.expected │ │ │ ├── backlink_unknown_symbol.expected │ │ │ ├── defining_both_class_prefixes.expected │ │ │ ├── backlink_illegal_symbol.expected │ │ │ ├── nullable_list_elements.expected │ │ │ ├── backlink_incompatible_type.expected │ │ │ ├── asymmetric_wrong_pk.expected │ │ │ ├── repeated_field_annotations.expected │ │ │ ├── unsupported_non_realm_type_set.expected │ │ │ ├── unsupported_realm_set_of_nullable_realmobject.expected │ │ │ ├── fts_index_wrong_type.expected │ │ │ ├── missing_underscore.expected │ │ │ ├── not_a_realm_type.expected │ │ │ ├── realm_object_reference_default_values.expected │ │ │ ├── set_non_empty_initializer.expected │ │ │ ├── list_non_empty_initializer.expected │ │ │ ├── date_primary_key.expected │ │ │ ├── dict_non_empty_initializer.expected │ │ │ ├── embedded_object_primary_key.expected │ │ │ ├── list_of_list_not_supported.expected │ │ │ ├── unsupported_realm_set_with_default_values.expected │ │ │ ├── unsupported_realm_set_of_nullable_realmvalue.expected │ │ │ ├── bool_not_allowed_as_primary_key.expected │ │ │ ├── not_an_indexable_type.expected │ │ │ ├── realm_value_not_allowed_as_primary_key.expected │ │ │ ├── long_mapped_to_name.expected │ │ │ ├── long_class_name.expected │ │ │ └── double_primary_key.expected │ │ ├── common.realm.dart │ │ ├── error_test.realm.dart │ │ ├── good_test.realm.dart │ │ ├── info_test.realm.dart │ │ ├── test_util.realm.dart │ │ ├── measure_test.realm.dart │ │ ├── info_test_data │ │ │ ├── primary_key_always_indexed.dart │ │ │ ├── primary_key_always_indexed.realm.dart │ │ │ └── primary_key_always_indexed.expected │ │ ├── measure_test.dart │ │ ├── good_test.dart │ │ ├── error_test.dart │ │ └── info_test.dart │ ├── lib │ │ ├── src │ │ │ ├── annotation_value.dart │ │ │ ├── utils.dart │ │ │ └── type_checkers.dart │ │ └── realm_generator.dart │ ├── .vscode │ │ └── launch.json │ ├── build.yaml │ └── pubspec.yaml └── CHANGELOG.ejson.md ├── media ├── favicon.ico └── vscode-switch-dart-version.png ├── .github ├── auto_assign.yml ├── workflows │ ├── auto-assign.yml │ ├── Issue-Needs-Attention.yml │ ├── lock-threads.yml │ ├── no-response.yml │ ├── check-changelog.yml │ └── update-samples.yml ├── ISSUE_TEMPLATE │ └── config.yml └── no-response.yml ├── pubspec.yaml ├── .gitmodules ├── .vscode └── extensions.json ├── .gitignore └── dartdoc_options.yaml /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | -------------------------------------------------------------------------------- /packages/README.ejson.md: -------------------------------------------------------------------------------- 1 | TODO! -------------------------------------------------------------------------------- /packages/ejson/LICENSE: -------------------------------------------------------------------------------- 1 | ../../LICENSE -------------------------------------------------------------------------------- /packages/realm/LICENSE: -------------------------------------------------------------------------------- 1 | ../../LICENSE -------------------------------------------------------------------------------- /packages/ejson/README.md: -------------------------------------------------------------------------------- 1 | ../README.ejson.md -------------------------------------------------------------------------------- /packages/ejson_lint/LICENSE: -------------------------------------------------------------------------------- 1 | ../../LICENSE -------------------------------------------------------------------------------- /packages/realm/README.md: -------------------------------------------------------------------------------- 1 | ../../README.md -------------------------------------------------------------------------------- /packages/realm_common/LICENSE: -------------------------------------------------------------------------------- 1 | ../../LICENSE -------------------------------------------------------------------------------- /packages/realm_dart/LICENSE: -------------------------------------------------------------------------------- 1 | ../../LICENSE -------------------------------------------------------------------------------- /packages/ejson/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ../CHANGELOG.ejson.md -------------------------------------------------------------------------------- /packages/ejson_analyzer/LICENSE: -------------------------------------------------------------------------------- 1 | ../../LICENSE -------------------------------------------------------------------------------- /packages/ejson_annotation/LICENSE: -------------------------------------------------------------------------------- 1 | ../../LICENSE -------------------------------------------------------------------------------- /packages/ejson_generator/LICENSE: -------------------------------------------------------------------------------- 1 | ../../LICENSE -------------------------------------------------------------------------------- /packages/ejson_lint/README.md: -------------------------------------------------------------------------------- 1 | ../README.ejson.md -------------------------------------------------------------------------------- /packages/realm/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ../../CHANGELOG.md -------------------------------------------------------------------------------- /packages/realm_common/README.md: -------------------------------------------------------------------------------- 1 | ../../README.md -------------------------------------------------------------------------------- /packages/realm_dart/README.md: -------------------------------------------------------------------------------- 1 | ../../README.md -------------------------------------------------------------------------------- /packages/realm_generator/LICENSE: -------------------------------------------------------------------------------- 1 | ../../LICENSE -------------------------------------------------------------------------------- /packages/ejson_analyzer/README.md: -------------------------------------------------------------------------------- 1 | ../README.ejson.md -------------------------------------------------------------------------------- /packages/ejson_annotation/README.md: -------------------------------------------------------------------------------- 1 | ../README.ejson.md -------------------------------------------------------------------------------- /packages/ejson_generator/README.md: -------------------------------------------------------------------------------- 1 | ../README.ejson.md -------------------------------------------------------------------------------- /packages/ejson_lint/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ../CHANGELOG.ejson.md -------------------------------------------------------------------------------- /packages/realm/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | ../../CONTRIBUTING.md -------------------------------------------------------------------------------- /packages/realm/linux/binary: -------------------------------------------------------------------------------- 1 | ../../realm_dart/binary/ -------------------------------------------------------------------------------- /packages/realm/windows/binary: -------------------------------------------------------------------------------- 1 | ../../realm_dart/binary/ -------------------------------------------------------------------------------- /packages/realm_common/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ../../CHANGELOG.md -------------------------------------------------------------------------------- /packages/realm_dart/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ../../CHANGELOG.md -------------------------------------------------------------------------------- /packages/realm_generator/README.md: -------------------------------------------------------------------------------- 1 | ../../README.md -------------------------------------------------------------------------------- /packages/ejson_analyzer/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ../CHANGELOG.ejson.md -------------------------------------------------------------------------------- /packages/ejson_generator/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ../CHANGELOG.ejson.md -------------------------------------------------------------------------------- /packages/realm_common/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | ../../CONTRIBUTING.md -------------------------------------------------------------------------------- /packages/realm_dart/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | ../../CONTRIBUTING.md -------------------------------------------------------------------------------- /packages/realm_generator/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ../../CHANGELOG.md -------------------------------------------------------------------------------- /packages/ejson/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | ../../analysis_options.yaml -------------------------------------------------------------------------------- /packages/ejson_annotation/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ../CHANGELOG.ejson.md -------------------------------------------------------------------------------- /packages/realm/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | ../../analysis_options.yaml -------------------------------------------------------------------------------- /packages/realm/dartdoc_options.yaml: -------------------------------------------------------------------------------- 1 | ../../dartdoc_options.yaml -------------------------------------------------------------------------------- /packages/realm/tests/test/data: -------------------------------------------------------------------------------- 1 | ../../../realm_dart/test/data -------------------------------------------------------------------------------- /packages/realm_generator/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | ../../CONTRIBUTING.md -------------------------------------------------------------------------------- /packages/ejson_lint/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | ../../analysis_options.yaml -------------------------------------------------------------------------------- /packages/realm_common/dartdoc_options.yaml: -------------------------------------------------------------------------------- 1 | ../../dartdoc_options.yaml -------------------------------------------------------------------------------- /packages/realm_dart/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | ../../analysis_options.yaml -------------------------------------------------------------------------------- /packages/realm_dart/dart_test.yaml: -------------------------------------------------------------------------------- 1 | tags: 2 | baas: { timeout: 2x } -------------------------------------------------------------------------------- /packages/realm_dart/dartdoc_options.yaml: -------------------------------------------------------------------------------- 1 | ../../dartdoc_options.yaml -------------------------------------------------------------------------------- /packages/ejson_analyzer/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | ../../analysis_options.yaml -------------------------------------------------------------------------------- /packages/ejson_generator/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | ../../analysis_options.yaml -------------------------------------------------------------------------------- /packages/realm/android/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'realm' 2 | -------------------------------------------------------------------------------- /packages/realm/tests/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | ../../../analysis_options.yaml -------------------------------------------------------------------------------- /packages/realm_common/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | ../../analysis_options.yaml -------------------------------------------------------------------------------- /packages/realm_generator/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | ../../analysis_options.yaml -------------------------------------------------------------------------------- /packages/realm_generator/dartdoc_options.yaml: -------------------------------------------------------------------------------- 1 | ../../dartdoc_options.yaml -------------------------------------------------------------------------------- /packages/ejson_annotation/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | ../../analysis_options.yaml -------------------------------------------------------------------------------- /packages/realm/example/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | ../../../analysis_options.yaml -------------------------------------------------------------------------------- /packages/realm_dart/dev/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 1.0.0 2 | 3 | - Initial version. 4 | -------------------------------------------------------------------------------- /packages/realm_dart/dev/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | ../../../analysis_options.yaml -------------------------------------------------------------------------------- /packages/realm_generator/.pubignore: -------------------------------------------------------------------------------- 1 | # Ignore test resources 2 | /test/ 3 | -------------------------------------------------------------------------------- /packages/ejson_lint/example/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 1.0.0 2 | 3 | - Initial version. 4 | -------------------------------------------------------------------------------- /packages/ejson_lint/example/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | ../../../analysis_options.yaml -------------------------------------------------------------------------------- /packages/realm/android/src/main/cpp/lib: -------------------------------------------------------------------------------- 1 | ../../../../../realm_dart/binary/android -------------------------------------------------------------------------------- /packages/realm/android/src/main/cpp/realm_plugin.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | -------------------------------------------------------------------------------- /packages/realm_dart/.gitignore: -------------------------------------------------------------------------------- 1 | /binary/ 2 | /build-native/ 3 | /mongodb-realm/ 4 | -------------------------------------------------------------------------------- /packages/realm_dart/example/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | ../../../analysis_options.yaml -------------------------------------------------------------------------------- /media/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realm/realm-dart/HEAD/media/favicon.ico -------------------------------------------------------------------------------- /.github/auto_assign.yml: -------------------------------------------------------------------------------- 1 | addAssignees: author 2 | addReviewers: false 3 | runOnDraft: true 4 | -------------------------------------------------------------------------------- /packages/realm/ios/realm_dart.xcframework: -------------------------------------------------------------------------------- 1 | ../../realm_dart/binary/ios/realm_dart.xcframework -------------------------------------------------------------------------------- /packages/realm/tests/ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /packages/ejson_lint/dart_dependency_validator.yaml: -------------------------------------------------------------------------------- 1 | exclude: 2 | - "example/**" # example is its own project -------------------------------------------------------------------------------- /packages/realm_generator/test/good_test_data/all_named_ctor.realm.dart: -------------------------------------------------------------------------------- 1 | 2 | part of 'all_named_ctor.dart'; 3 | -------------------------------------------------------------------------------- /packages/realm_dart/lib/src/handles/native/convert_native.dart: -------------------------------------------------------------------------------- 1 | export 'to_native.dart'; 2 | export 'from_native.dart'; 3 | -------------------------------------------------------------------------------- /media/vscode-switch-dart-version.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realm/realm-dart/HEAD/media/vscode-switch-dart-version.png -------------------------------------------------------------------------------- /packages/ejson_lint/example/README.md: -------------------------------------------------------------------------------- 1 | This project is used to test lint rules using 2 | ```shell 3 | dart run custom_lint 4 | ``` 5 | -------------------------------------------------------------------------------- /packages/realm/tests/build.yaml: -------------------------------------------------------------------------------- 1 | targets: 2 | $default: 3 | builders: 4 | realm_generator: 5 | enabled: true 6 | -------------------------------------------------------------------------------- /packages/ejson_lint/example/dart_dependency_validator.yaml: -------------------------------------------------------------------------------- 1 | 2 | ignore: 3 | # validator mistakenly flags this 4 | - ejson_lint 5 | -------------------------------------------------------------------------------- /packages/realm/tests/android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx4G 2 | android.useAndroidX=true 3 | android.enableJetifier=true 4 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: my_project_workspace 2 | 3 | environment: 4 | sdk: '>=3.0.0 <4.0.0' 5 | dev_dependencies: 6 | melos: ^5.2.0 7 | -------------------------------------------------------------------------------- /packages/realm/tests/macos/Runner/Configs/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Debug.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /packages/realm/tests/macos/Runner/Configs/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Release.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /packages/realm/lib/realm.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2024 MongoDB, Inc. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | export 'package:realm_dart/realm.dart'; 5 | -------------------------------------------------------------------------------- /packages/ejson_lint/lib/ejson_lint.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2024 MongoDB, Inc. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | export 'src/ejson_lint_base.dart'; 5 | -------------------------------------------------------------------------------- /packages/realm/tests/ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /packages/ejson_generator/lib/ejson_generator.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2024 MongoDB, Inc. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | export 'src/builder.dart'; 5 | -------------------------------------------------------------------------------- /packages/realm/android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realm/realm-dart/HEAD/packages/realm/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /packages/realm/android/src/gen/RealmConfig.java: -------------------------------------------------------------------------------- 1 | package io.realm; 2 | 3 | class RealmConfig { 4 | public static final String bundleId = "realm_bundle_id"; 5 | } -------------------------------------------------------------------------------- /packages/realm/android/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | -------------------------------------------------------------------------------- /packages/realm/tests/ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /packages/realm/tests/windows/runner/resources/app_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realm/realm-dart/HEAD/packages/realm/tests/windows/runner/resources/app_icon.ico -------------------------------------------------------------------------------- /packages/realm_dart/test/data/realm_files/old-format.realm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realm/realm-dart/HEAD/packages/realm_dart/test/data/realm_files/old-format.realm -------------------------------------------------------------------------------- /packages/realm/android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.useAndroidX=true 3 | android.enableJetifier=true 4 | android.native.buildOutput=verbose 5 | -------------------------------------------------------------------------------- /packages/ejson_analyzer/lib/ejson_analyzer.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2024 MongoDB, Inc. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | export 'src/ejson_analyzer_base.dart'; 5 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "packages/realm_dart/src/realm-core"] 2 | path = packages/realm_dart/src/realm-core 3 | url = https://github.com/realm/realm-core.git 4 | branch = master 5 | -------------------------------------------------------------------------------- /packages/realm/tests/macos/Flutter/Flutter-Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "ephemeral/Flutter-Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /packages/realm/tests/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realm/realm-dart/HEAD/packages/realm/tests/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /packages/realm/tests/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realm/realm-dart/HEAD/packages/realm/tests/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /packages/realm/tests/macos/Flutter/Flutter-Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "ephemeral/Flutter-Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /packages/realm/tests/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realm/realm-dart/HEAD/packages/realm/tests/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /packages/realm/tests/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realm/realm-dart/HEAD/packages/realm/tests/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /packages/realm/tests/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realm/realm-dart/HEAD/packages/realm/tests/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /packages/realm/tests/.gitignore: -------------------------------------------------------------------------------- 1 | # Don't commit platform specific files for examples 2 | # Use flutter create . --platforms= to generate them 3 | android/ 4 | ios/ 5 | linux/ 6 | macos/ 7 | windows/ 8 | -------------------------------------------------------------------------------- /packages/realm_generator/test/good_test_data/pinhole.dart: -------------------------------------------------------------------------------- 1 | import 'package:realm_common/realm_common.dart'; 2 | 3 | part 'pinhole.realm.dart'; 4 | 5 | @RealmModel() 6 | class _Foo { 7 | int x = 0; 8 | } 9 | -------------------------------------------------------------------------------- /packages/realm/example/.gitignore: -------------------------------------------------------------------------------- 1 | # Don't commit platform specific files for examples 2 | # Use flutter create . --platforms= to generate them 3 | android/ 4 | ios/ 5 | linux/ 6 | macos/ 7 | windows/ 8 | -------------------------------------------------------------------------------- /packages/ejson_lint/example/.gitignore: -------------------------------------------------------------------------------- 1 | # Don't commit platform specific files for examples 2 | # Use flutter create . --platforms= to generate them 3 | android/ 4 | ios/ 5 | linux/ 6 | macos/ 7 | windows/ 8 | -------------------------------------------------------------------------------- /packages/realm/tests/android/app/src/main/kotlin/io/realm/tests/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package io.realm.tests 2 | 3 | import io.flutter.embedding.android.FlutterActivity 4 | 5 | class MainActivity: FlutterActivity() { 6 | } 7 | -------------------------------------------------------------------------------- /packages/realm/tests/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realm/realm-dart/HEAD/packages/realm/tests/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /packages/realm/tests/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realm/realm-dart/HEAD/packages/realm/tests/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png -------------------------------------------------------------------------------- /packages/realm/tests/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realm/realm-dart/HEAD/packages/realm/tests/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png -------------------------------------------------------------------------------- /packages/realm/tests/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realm/realm-dart/HEAD/packages/realm/tests/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png -------------------------------------------------------------------------------- /packages/realm/tests/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realm/realm-dart/HEAD/packages/realm/tests/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png -------------------------------------------------------------------------------- /packages/realm/tests/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realm/realm-dart/HEAD/packages/realm/tests/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png -------------------------------------------------------------------------------- /packages/realm/tests/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realm/realm-dart/HEAD/packages/realm/tests/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png -------------------------------------------------------------------------------- /packages/realm_dart/lib/src/handles/web/web_not_supported.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2024 MongoDB, Inc. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | Never webNotSupported() => throw UnsupportedError('web not supported'); 5 | -------------------------------------------------------------------------------- /packages/realm/tests/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realm/realm-dart/HEAD/packages/realm/tests/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /packages/realm/tests/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realm/realm-dart/HEAD/packages/realm/tests/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /packages/realm/tests/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realm/realm-dart/HEAD/packages/realm/tests/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /packages/realm/tests/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realm/realm-dart/HEAD/packages/realm/tests/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /packages/realm/tests/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realm/realm-dart/HEAD/packages/realm/tests/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /packages/realm/tests/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realm/realm-dart/HEAD/packages/realm/tests/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /packages/realm/tests/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realm/realm-dart/HEAD/packages/realm/tests/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /packages/realm/tests/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realm/realm-dart/HEAD/packages/realm/tests/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /packages/realm/tests/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realm/realm-dart/HEAD/packages/realm/tests/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /packages/realm/tests/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realm/realm-dart/HEAD/packages/realm/tests/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /packages/realm/tests/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realm/realm-dart/HEAD/packages/realm/tests/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /packages/realm/tests/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realm/realm-dart/HEAD/packages/realm/tests/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /packages/realm/tests/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realm/realm-dart/HEAD/packages/realm/tests/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /packages/realm/tests/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realm/realm-dart/HEAD/packages/realm/tests/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /packages/realm/tests/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realm/realm-dart/HEAD/packages/realm/tests/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /packages/realm/tests/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realm/realm-dart/HEAD/packages/realm/tests/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": [ 3 | "Dart-Code.dart-code", 4 | "Dart-Code.flutter", 5 | "ms-vscode.cpptools", 6 | "ms-vscode.cmake-tools", 7 | "twxs.cmake", 8 | ] 9 | } -------------------------------------------------------------------------------- /packages/realm/bin/realm.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2021 MongoDB, Inc. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import 'package:realm_dart/src/cli/main.dart' as x; 5 | 6 | void main(List arguments) => x.main(arguments); 7 | -------------------------------------------------------------------------------- /packages/realm/tests/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realm/realm-dart/HEAD/packages/realm/tests/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /packages/realm/tests/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realm/realm-dart/HEAD/packages/realm/tests/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /packages/realm/tests/linux/main.cc: -------------------------------------------------------------------------------- 1 | #include "my_application.h" 2 | 3 | int main(int argc, char** argv) { 4 | g_autoptr(MyApplication) app = my_application_new(); 5 | return g_application_run(G_APPLICATION(app), argc, argv); 6 | } 7 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/backlink_annotation_on_incompatible_field.dart: -------------------------------------------------------------------------------- 1 | import 'package:realm_common/realm_common.dart'; 2 | 3 | @RealmModel() 4 | class _Foo { 5 | @Backlink(#bad) 6 | late bool bad; 7 | } 8 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/fts_index_wrong_type.dart: -------------------------------------------------------------------------------- 1 | import 'package:realm_common/realm_common.dart'; 2 | 3 | @RealmModel() 4 | class _Foo { 5 | @Indexed(RealmIndexType.fullText) 6 | late bool boolValue; 7 | } 8 | -------------------------------------------------------------------------------- /packages/realm_generator/test/good_test_data/optional_argument.dart: -------------------------------------------------------------------------------- 1 | import 'package:realm_common/realm_common.dart'; 2 | 3 | part 'optional_argument.realm.dart'; 4 | 5 | @RealmModel() 6 | class _Person { 7 | _Person? spouse; 8 | } 9 | -------------------------------------------------------------------------------- /packages/realm_dart/lib/src/convert.dart: -------------------------------------------------------------------------------- 1 | extension NullableObjectEx on T? { 2 | U? convert(U Function(T) convertor) { 3 | final self = this; 4 | if (self == null) return null; 5 | return convertor(self); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/backlink_annotation_on_invalid_iterable.dart: -------------------------------------------------------------------------------- 1 | import 'package:realm_common/realm_common.dart'; 2 | 3 | @RealmModel() 4 | class _Foo { 5 | @Backlink(#bad) 6 | late Iterable bad; 7 | } 8 | -------------------------------------------------------------------------------- /packages/realm_dart/bin/realm_dart.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2021 MongoDB, Inc. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import 'package:realm_dart/src/cli/main.dart' as x; 5 | 6 | void main(List arguments) => x.main(arguments); 7 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/nullable_realm_value.dart: -------------------------------------------------------------------------------- 1 | import 'package:realm_common/realm_common.dart'; 2 | 3 | part 'nullable_realm_value.realm.dart'; 4 | 5 | @RealmModel() 6 | class _Bad { 7 | RealmValue? wrong; 8 | } 9 | -------------------------------------------------------------------------------- /packages/realm/tests/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/map_unsupported.dart: -------------------------------------------------------------------------------- 1 | import 'package:realm_common/realm_common.dart'; 2 | 3 | part 'map_unsupported.realm.dart'; 4 | 5 | @RealmModel() 6 | class _Person { 7 | late Map relatives; 8 | } 9 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/realm_value_not_allowed_as_primary_key.dart: -------------------------------------------------------------------------------- 1 | import 'package:realm_common/realm_common.dart'; 2 | 3 | @RealmModel() 4 | @MapTo('Bad') 5 | class _Foo { 6 | @PrimaryKey() 7 | late RealmValue bad; 8 | } 9 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/asymmetric_wrong_pk.dart: -------------------------------------------------------------------------------- 1 | import 'package:realm_common/realm_common.dart'; 2 | 3 | @RealmModel(ObjectType.asymmetricObject) 4 | class _BadAsymmetric { 5 | @PrimaryKey() 6 | late ObjectId wrongName; 7 | } 8 | -------------------------------------------------------------------------------- /packages/realm_dart/lib/src/handles/notification_token_handle.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2024 MongoDB, Inc. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import 'handle_base.dart'; 5 | 6 | abstract interface class NotificationTokenHandle extends HandleBase {} 7 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/invalid_model_name_prefix.dart: -------------------------------------------------------------------------------- 1 | import 'package:realm_common/realm_common.dart'; 2 | 3 | part 'invalid_model_name_prefix.realm.dart'; 4 | 5 | @RealmModel() 6 | class Bad { 7 | // missing _ or $ prefix 8 | } 9 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/repeated_class_annotations.dart: -------------------------------------------------------------------------------- 1 | import 'package:realm_common/realm_common.dart'; 2 | 3 | part 'repeated_class_annotations.realm.dart'; 4 | 5 | @RealmModel() 6 | @MapTo('Bad') 7 | @RealmModel() 8 | class _Bad {} 9 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/date_primary_key.dart: -------------------------------------------------------------------------------- 1 | import 'package:realm_common/realm_common.dart'; 2 | 3 | part 'date_primary_key.realm.dart'; 4 | 5 | @RealmModel() 6 | class _Bad { 7 | @PrimaryKey() 8 | late DateTime id; 9 | } 10 | -------------------------------------------------------------------------------- /packages/realm_generator/test/good_test_data/required_argument.dart: -------------------------------------------------------------------------------- 1 | import 'package:realm_common/realm_common.dart'; 2 | 3 | part 'required_argument.realm.dart'; 4 | 5 | @RealmModel() 6 | class _Person { 7 | @PrimaryKey() 8 | late String name; 9 | } 10 | -------------------------------------------------------------------------------- /packages/realm_generator/test/good_test_data/required_argument_with_default_value.dart: -------------------------------------------------------------------------------- 1 | import 'package:realm_common/realm_common.dart'; 2 | 3 | part 'required_argument_with_default_value.realm.dart'; 4 | 5 | @RealmModel() 6 | class _Person { 7 | int age = 47; 8 | } 9 | -------------------------------------------------------------------------------- /packages/realm_generator/test/common.realm.dart: -------------------------------------------------------------------------------- 1 | // MOCK FILE! This file exists to ensure the parent file is valid Dart. 2 | // The parent will be used as input to the realm_generator in a test, and the 3 | // output compared to the .expected file. 4 | part of 'common.dart'; 5 | -------------------------------------------------------------------------------- /packages/realm_dart/lib/src/handles/handle_base.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2024 MongoDB, Inc. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | abstract class HandleBase { 5 | bool get released; 6 | bool get isUnowned; 7 | void releaseCore(); 8 | void release(); 9 | } 10 | -------------------------------------------------------------------------------- /packages/realm_dart/lib/src/handles/web/default_client.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2024 MongoDB, Inc. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import 'package:http/browser_client.dart'; 5 | import 'package:http/http.dart'; 6 | 7 | Client defaultClient() => BrowserClient(); 8 | -------------------------------------------------------------------------------- /packages/realm_dart/lib/src/realm_dart.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2021 MongoDB, Inc. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | export 'realm_class.dart' hide RealmInternal; 5 | 6 | /// @nodoc 7 | // is Realm loaded in Flutter or Dart 8 | const bool isFlutterPlatform = false; 9 | -------------------------------------------------------------------------------- /packages/realm_dart/lib/src/realm_flutter.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2021 MongoDB, Inc. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | export 'realm_class.dart' hide RealmInternal; 5 | 6 | /// @nodoc 7 | // is Realm loaded in Flutter or Dart 8 | const bool isFlutterPlatform = true; 9 | -------------------------------------------------------------------------------- /packages/realm_dart/scripts/build-linux.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | set -o pipefail 5 | 6 | # Start in the root directory of the project. 7 | cd "$(dirname "$0")/.." 8 | 9 | cmake --preset linux 10 | cmake --build --preset linux --config MinSizeRel 11 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/asymmetric_missing_pk.dart: -------------------------------------------------------------------------------- 1 | import 'package:realm_common/realm_common.dart'; 2 | 3 | @RealmModel(ObjectType.asymmetricObject) 4 | class _BadAsymmetric { 5 | // missing @PrimaryKey() 6 | @MapTo('_id') 7 | late ObjectId id; 8 | } 9 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/defining_both_class_prefixes.dart: -------------------------------------------------------------------------------- 1 | import 'package:realm_common/realm_common.dart'; 2 | 3 | part 'defining_both_class_prefixes.realm.dart'; 4 | 5 | @RealmModel() 6 | class $Bad1 {} 7 | 8 | @RealmModel() 9 | class _Bad1 {} 10 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/nullable_set.dart: -------------------------------------------------------------------------------- 1 | import 'package:realm_common/realm_common.dart'; 2 | 3 | part 'nullable_set.realm.dart'; 4 | 5 | @RealmModel() 6 | class _Bad { 7 | @PrimaryKey() 8 | late int id; 9 | 10 | Set? wrong; 11 | } 12 | -------------------------------------------------------------------------------- /packages/realm/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | zipStoreBase=GRADLE_USER_HOME 4 | zipStorePath=wrapper/dists 5 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip 6 | -------------------------------------------------------------------------------- /packages/realm_dart/lib/src/handles/web/list_handle.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2024 MongoDB, Inc. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import '../list_handle.dart' as intf; 5 | import 'handle_base.dart'; 6 | 7 | class ListHandle extends HandleBase implements intf.ListHandle {} 8 | -------------------------------------------------------------------------------- /packages/realm_dart/lib/src/handles/web/map_handle.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2024 MongoDB, Inc. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import '../map_handle.dart' as intf; 5 | import 'handle_base.dart'; 6 | 7 | class MapHandle extends HandleBase implements intf.MapHandle {} 8 | -------------------------------------------------------------------------------- /packages/realm_dart/lib/src/handles/web/set_handle.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2024 MongoDB, Inc. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import '../set_handle.dart' as intf; 5 | import 'handle_base.dart'; 6 | 7 | class SetHandle extends HandleBase implements intf.SetHandle {} 8 | -------------------------------------------------------------------------------- /packages/realm_dart/lib/src/handles/web/user_handle.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2024 MongoDB, Inc. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import '../user_handle.dart' as intf; 5 | import 'handle_base.dart'; 6 | 7 | class UserHandle extends HandleBase implements intf.UserHandle {} 8 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test.realm.dart: -------------------------------------------------------------------------------- 1 | // MOCK FILE! This file exists to ensure the parent file is valid Dart. 2 | // The parent will be used as input to the realm_generator in a test, and the 3 | // output compared to the .expected file. 4 | part of 'error_test.dart'; 5 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/not_a_realm_type.dart: -------------------------------------------------------------------------------- 1 | import 'package:realm_common/realm_common.dart'; 2 | 3 | part 'not_a_realm_type.realm.dart'; 4 | 5 | class NonRealm {} 6 | 7 | @RealmModel() 8 | class _Bad { 9 | late NonRealm notARealmType; 10 | } 11 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/not_an_indexable_type.dart: -------------------------------------------------------------------------------- 1 | import 'package:realm_common/realm_common.dart'; 2 | 3 | part 'not_an_indexable_type.realm.dart'; 4 | 5 | @RealmModel() 6 | class _Bad { 7 | @Indexed() 8 | late double notAnIndexableType; 9 | } 10 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/nullable_list.dart: -------------------------------------------------------------------------------- 1 | import 'package:realm_common/realm_common.dart'; 2 | 3 | part 'nullable_list.realm.dart'; 4 | 5 | @RealmModel() 6 | class _Bad { 7 | @PrimaryKey() 8 | late int id; 9 | 10 | List? wrong; 11 | } 12 | -------------------------------------------------------------------------------- /packages/realm_generator/test/good_test.realm.dart: -------------------------------------------------------------------------------- 1 | // MOCK FILE! This file exists to ensure the parent file is valid Dart. 2 | // The parent will be used as input to the realm_generator in a test, and the 3 | // output compared to the .expected file. 4 | part of 'good_test.dart'; 5 | -------------------------------------------------------------------------------- /packages/realm_generator/test/good_test_data/map.realm.dart: -------------------------------------------------------------------------------- 1 | // MOCK FILE! This file exists to ensure the parent file is valid Dart. 2 | // The parent will be used as input to the realm_generator in a test, and the 3 | // output compared to the .expected file. 4 | part of 'map.dart'; 5 | -------------------------------------------------------------------------------- /packages/realm_generator/test/info_test.realm.dart: -------------------------------------------------------------------------------- 1 | // MOCK FILE! This file exists to ensure the parent file is valid Dart. 2 | // The parent will be used as input to the realm_generator in a test, and the 3 | // output compared to the .expected file. 4 | part of 'info_test.dart'; 5 | -------------------------------------------------------------------------------- /packages/realm_generator/test/test_util.realm.dart: -------------------------------------------------------------------------------- 1 | // MOCK FILE! This file exists to ensure the parent file is valid Dart. 2 | // The parent will be used as input to the realm_generator in a test, and the 3 | // output compared to the .expected file. 4 | part of 'test_util.dart'; 5 | -------------------------------------------------------------------------------- /packages/realm/tests/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | zipStoreBase=GRADLE_USER_HOME 4 | zipStorePath=wrapper/dists 5 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-all.zip 6 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/const_initializer.dart: -------------------------------------------------------------------------------- 1 | import 'dart:math'; 2 | 3 | import 'package:realm_common/realm_common.dart'; 4 | 5 | part 'const_initializer.realm.dart'; 6 | 7 | @RealmModel() 8 | class _Bad { 9 | var id = Random().nextInt(1000); 10 | } 11 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/set_non_empty_initializer.dart: -------------------------------------------------------------------------------- 1 | import 'package:realm_common/realm_common.dart'; 2 | 3 | //part 'set_non_empty_initializer.g.dart'; 4 | 5 | @RealmModel() 6 | class _Bad { 7 | late int x; 8 | final setWithInitializer = {0}; 9 | } 10 | -------------------------------------------------------------------------------- /packages/realm_generator/test/good_test_data/mapto.realm.dart: -------------------------------------------------------------------------------- 1 | // MOCK FILE! This file exists to ensure the parent file is valid Dart. 2 | // The parent will be used as input to the realm_generator in a test, and the 3 | // output compared to the .expected file. 4 | part of 'mapto.dart'; 5 | -------------------------------------------------------------------------------- /packages/realm_generator/test/measure_test.realm.dart: -------------------------------------------------------------------------------- 1 | // MOCK FILE! This file exists to ensure the parent file is valid Dart. 2 | // The parent will be used as input to the realm_generator in a test, and the 3 | // output compared to the .expected file. 4 | part of 'measure_test.dart'; 5 | -------------------------------------------------------------------------------- /packages/realm_dart/lib/realm.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2021 MongoDB, Inc. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | // dart.library.cli is available only on dart desktop 5 | export 'src/realm_flutter.dart' if (dart.library.cli) 'src/realm_dart.dart'; 6 | export 'package:ejson/ejson.dart'; 7 | -------------------------------------------------------------------------------- /packages/realm_dart/lib/src/handles/web/object_handle.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2024 MongoDB, Inc. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import '../object_handle.dart' as intf; 5 | import 'handle_base.dart'; 6 | 7 | class ObjectHandle extends HandleBase implements intf.ObjectHandle {} 8 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/illigal_constructor.dart: -------------------------------------------------------------------------------- 1 | import 'package:realm_common/realm_common.dart'; 2 | 3 | part 'illigal_constructor.realm.dart'; 4 | 5 | @RealmModel() 6 | class _Bad { 7 | @PrimaryKey() 8 | late int id; 9 | 10 | _Bad(this.id); 11 | } 12 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/invalid_extend.dart: -------------------------------------------------------------------------------- 1 | import 'package:realm_common/realm_common.dart'; 2 | 3 | part 'invalid_extend.realm.dart'; 4 | 5 | class Base {} 6 | 7 | @RealmModel() 8 | class _Bad extends Base { 9 | @PrimaryKey() 10 | late int id; 11 | } 12 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/invalid_extend.expected: -------------------------------------------------------------------------------- 1 | Realm model classes can only extend Object 2 | 3 | in: asset:pkg/test/error_test_data/invalid_extend.dart:8:7 4 | ╷ 5 | 7 │ @RealmModel() 6 | 8 │ class _Bad extends Base { 7 | │ ^^^^ cannot extend Base 8 | ╵ 9 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/list_non_empty_initializer.dart: -------------------------------------------------------------------------------- 1 | import 'package:realm_common/realm_common.dart'; 2 | 3 | //part 'list_non_empty_initializer.g.dart'; 4 | 5 | @RealmModel() 6 | class _Bad { 7 | late int x; 8 | final listWithInitializer = [0]; 9 | } 10 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/long_class_name.dart: -------------------------------------------------------------------------------- 1 | import 'package:realm_common/realm_common.dart'; 2 | 3 | part 'long_class_name.realm.dart'; 4 | 5 | @RealmModel() 6 | class _ThisIsAVeryLongClassNameSoLongInFactThatItRunsOverThe57CharacterLimit { 7 | late int id; 8 | } 9 | -------------------------------------------------------------------------------- /packages/realm_generator/test/good_test_data/pinhole.realm.dart: -------------------------------------------------------------------------------- 1 | // MOCK FILE! This file exists to ensure the parent file is valid Dart. 2 | // The parent will be used as input to the realm_generator in a test, and the 3 | // output compared to the .expected file. 4 | part of 'pinhole.dart'; 5 | -------------------------------------------------------------------------------- /packages/realm_dart/lib/src/handles/web/results_handle.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2024 MongoDB, Inc. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import '../results_handle.dart' as intf; 5 | import 'handle_base.dart'; 6 | 7 | class ResultsHandle extends HandleBase implements intf.ResultsHandle {} 8 | -------------------------------------------------------------------------------- /packages/realm_dart/lib/src/handles/web/session_handle.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2024 MongoDB, Inc. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import '../session_handle.dart' as intf; 5 | import 'handle_base.dart'; 6 | 7 | class SessionHandle extends HandleBase implements intf.SessionHandle {} 8 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/dict_non_empty_initializer.dart: -------------------------------------------------------------------------------- 1 | import 'package:realm_common/realm_common.dart'; 2 | 3 | //part 'dict_non_empty_initializer.g.dart'; 4 | 5 | @RealmModel() 6 | class _Bad { 7 | late int x; 8 | final dictWithInitializer = {"a": 5}; 9 | } 10 | -------------------------------------------------------------------------------- /packages/realm_generator/test/good_test_data/all_types.realm.dart: -------------------------------------------------------------------------------- 1 | // MOCK FILE! This file exists to ensure the parent file is valid Dart. 2 | // The parent will be used as input to the realm_generator in a test, and the 3 | // output compared to the .expected file. 4 | part of 'all_types.dart'; 5 | -------------------------------------------------------------------------------- /packages/realm_generator/test/good_test_data/binary_type.realm.dart: -------------------------------------------------------------------------------- 1 | // MOCK FILE! This file exists to ensure the parent file is valid Dart. 2 | // The parent will be used as input to the realm_generator in a test, and the 3 | // output compared to the .expected file. 4 | part of 'binary_type.dart'; 5 | -------------------------------------------------------------------------------- /packages/realm_generator/test/good_test_data/primary_key.realm.dart: -------------------------------------------------------------------------------- 1 | // MOCK FILE! This file exists to ensure the parent file is valid Dart. 2 | // The parent will be used as input to the realm_generator in a test, and the 3 | // output compared to the .expected file. 4 | part of 'primary_key.dart'; 5 | -------------------------------------------------------------------------------- /packages/realm_generator/test/good_test_data/realm_set.realm.dart: -------------------------------------------------------------------------------- 1 | // MOCK FILE! This file exists to ensure the parent file is valid Dart. 2 | // The parent will be used as input to the realm_generator in a test, and the 3 | // output compared to the .expected file. 4 | part of 'realm_set.dart'; 5 | -------------------------------------------------------------------------------- /packages/realm_dart/lib/src/realm_web.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2024 MongoDB, Inc. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | /// @nodoc 5 | // is Realm loaded in Flutter or Dart 6 | const bool isFlutterPlatform = false; 7 | 8 | /// @nodoc 9 | const String realmBinaryName = 'realm_dart'; 10 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/embedded_object_primary_key.dart: -------------------------------------------------------------------------------- 1 | import 'package:realm_common/realm_common.dart'; 2 | 3 | part 'embedded_object_primary_key.realm.dart'; 4 | 5 | @RealmModel(ObjectType.embeddedObject) 6 | class _Bad { 7 | @PrimaryKey() 8 | late int id; 9 | } 10 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/nullable_list.realm.dart: -------------------------------------------------------------------------------- 1 | // MOCK FILE! This file exists to ensure the parent file is valid Dart. 2 | // The parent will be used as input to the realm_generator in a test, and the 3 | // output compared to the .expected file. 4 | part of 'nullable_list.dart'; 5 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/nullable_set.realm.dart: -------------------------------------------------------------------------------- 1 | // MOCK FILE! This file exists to ensure the parent file is valid Dart. 2 | // The parent will be used as input to the realm_generator in a test, and the 3 | // output compared to the .expected file. 4 | part of 'nullable_set.dart'; 5 | -------------------------------------------------------------------------------- /packages/realm_generator/test/good_test_data/another_mapto.realm.dart: -------------------------------------------------------------------------------- 1 | // MOCK FILE! This file exists to ensure the parent file is valid Dart. 2 | // The parent will be used as input to the realm_generator in a test, and the 3 | // output compared to the .expected file. 4 | part of 'another_mapto.dart'; 5 | -------------------------------------------------------------------------------- /packages/realm/tests/macos/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | @NSApplicationMain 5 | class AppDelegate: FlutterAppDelegate { 6 | override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { 7 | return true 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/bool_not_allowed_as_primary_key.dart: -------------------------------------------------------------------------------- 1 | import 'package:realm_common/realm_common.dart'; 2 | 3 | part 'bool_not_allowed_as_primary_key.realm.dart'; 4 | 5 | @RealmModel() 6 | @MapTo('Bad') 7 | class _Foo { 8 | @PrimaryKey() 9 | late bool bad; 10 | } 11 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/invalid_extend.realm.dart: -------------------------------------------------------------------------------- 1 | // MOCK FILE! This file exists to ensure the parent file is valid Dart. 2 | // The parent will be used as input to the realm_generator in a test, and the 3 | // output compared to the .expected file. 4 | part of 'invalid_extend.dart'; 5 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/long_class_name.realm.dart: -------------------------------------------------------------------------------- 1 | // MOCK FILE! This file exists to ensure the parent file is valid Dart. 2 | // The parent will be used as input to the realm_generator in a test, and the 3 | // output compared to the .expected file. 4 | part of 'long_class_name.dart'; 5 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/map_unsupported.realm.dart: -------------------------------------------------------------------------------- 1 | // MOCK FILE! This file exists to ensure the parent file is valid Dart. 2 | // The parent will be used as input to the realm_generator in a test, and the 3 | // output compared to the .expected file. 4 | part of 'map_unsupported.dart'; 5 | -------------------------------------------------------------------------------- /packages/realm_generator/test/good_test_data/embedded_objects.realm.dart: -------------------------------------------------------------------------------- 1 | // MOCK FILE! This file exists to ensure the parent file is valid Dart. 2 | // The parent will be used as input to the realm_generator in a test, and the 3 | // output compared to the .expected file. 4 | part of 'embedded_objects.dart'; 5 | -------------------------------------------------------------------------------- /packages/realm_generator/test/good_test_data/indexable_types.realm.dart: -------------------------------------------------------------------------------- 1 | // MOCK FILE! This file exists to ensure the parent file is valid Dart. 2 | // The parent will be used as input to the realm_generator in a test, and the 3 | // output compared to the .expected file. 4 | part of 'indexable_types.dart'; 5 | -------------------------------------------------------------------------------- /packages/realm_dart/example/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: myapp 2 | description: A simple command-line application using Realm Dart SDK. 3 | 4 | publish_to: none 5 | 6 | environment: 7 | sdk: ^3.6.0 8 | 9 | dependencies: 10 | realm_dart: 11 | path: ../ 12 | 13 | dev_dependencies: 14 | lints: ^5.1.1 15 | -------------------------------------------------------------------------------- /packages/realm_dart/lib/src/handles/web/map_changes_handle.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2024 MongoDB, Inc. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import '../map_changes_handle.dart' as intf; 5 | import 'handle_base.dart'; 6 | 7 | class MapChangesHandle extends HandleBase implements intf.MapChangesHandle {} 8 | -------------------------------------------------------------------------------- /packages/realm_dart/scripts/build-macos.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | set -o pipefail 5 | 6 | # Start in the root directory of the project. 7 | cd "$(dirname "$0")/.." 8 | 9 | cmake --preset macos 10 | cmake --build --preset macos --config Release -- -destination "generic/platform=macOS" 11 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/const_initializer.realm.dart: -------------------------------------------------------------------------------- 1 | // MOCK FILE! This file exists to ensure the parent file is valid Dart. 2 | // The parent will be used as input to the realm_generator in a test, and the 3 | // output compared to the .expected file. 4 | part of 'const_initializer.dart'; 5 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/date_primary_key.realm.dart: -------------------------------------------------------------------------------- 1 | // MOCK FILE! This file exists to ensure the parent file is valid Dart. 2 | // The parent will be used as input to the realm_generator in a test, and the 3 | // output compared to the .expected file. 4 | part of 'date_primary_key.dart'; 5 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/double_primary_key.realm.dart: -------------------------------------------------------------------------------- 1 | // MOCK FILE! This file exists to ensure the parent file is valid Dart. 2 | // The parent will be used as input to the realm_generator in a test, and the 3 | // output compared to the .expected file. 4 | part of 'double_primary_key.dart'; 5 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/missing_underscore.realm.dart: -------------------------------------------------------------------------------- 1 | // MOCK FILE! This file exists to ensure the parent file is valid Dart. 2 | // The parent will be used as input to the realm_generator in a test, and the 3 | // output compared to the .expected file. 4 | part of 'missing_underscore.dart'; 5 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/not_a_realm_type.realm.dart: -------------------------------------------------------------------------------- 1 | // MOCK FILE! This file exists to ensure the parent file is valid Dart. 2 | // The parent will be used as input to the realm_generator in a test, and the 3 | // output compared to the .expected file. 4 | part of 'not_a_realm_type.dart'; 5 | -------------------------------------------------------------------------------- /packages/realm_generator/test/good_test_data/asymmetric_object.realm.dart: -------------------------------------------------------------------------------- 1 | // MOCK FILE! This file exists to ensure the parent file is valid Dart. 2 | // The parent will be used as input to the realm_generator in a test, and the 3 | // output compared to the .expected file. 4 | part of 'asymmetric_object.dart'; 5 | -------------------------------------------------------------------------------- /packages/realm_generator/test/good_test_data/const_initializer.realm.dart: -------------------------------------------------------------------------------- 1 | // MOCK FILE! This file exists to ensure the parent file is valid Dart. 2 | // The parent will be used as input to the realm_generator in a test, and the 3 | // output compared to the .expected file. 4 | part of 'const_initializer.dart'; 5 | -------------------------------------------------------------------------------- /packages/realm_generator/test/good_test_data/optional_argument.realm.dart: -------------------------------------------------------------------------------- 1 | // MOCK FILE! This file exists to ensure the parent file is valid Dart. 2 | // The parent will be used as input to the realm_generator in a test, and the 3 | // output compared to the .expected file. 4 | part of 'optional_argument.dart'; 5 | -------------------------------------------------------------------------------- /packages/realm_generator/test/good_test_data/private_fields.realm.dart: -------------------------------------------------------------------------------- 1 | // MOCK FILE! This file exists to ensure the parent file is valid Dart. 2 | // The parent will be used as input to the realm_generator in a test, and the 3 | // output compared to the .expected file. 4 | 5 | part of 'private_fields.dart'; 6 | -------------------------------------------------------------------------------- /packages/realm_generator/test/good_test_data/required_argument.realm.dart: -------------------------------------------------------------------------------- 1 | // MOCK FILE! This file exists to ensure the parent file is valid Dart. 2 | // The parent will be used as input to the realm_generator in a test, and the 3 | // output compared to the .expected file. 4 | part of 'required_argument.dart'; 5 | -------------------------------------------------------------------------------- /packages/realm_common/lib/realm_common.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2021 MongoDB, Inc. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | export 'src/realm_common_base.dart'; 5 | export 'src/realm_types.dart'; 6 | 7 | export 'package:objectid/objectid.dart' show ObjectId; 8 | export 'package:sane_uuid/uuid.dart' show Uuid; 9 | -------------------------------------------------------------------------------- /packages/realm_dart/lib/src/handles/web/subscription_handle.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2024 MongoDB, Inc. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import '../subscription_handle.dart' as intf; 5 | import 'handle_base.dart'; 6 | 7 | class SubscriptionHandle extends HandleBase implements intf.SubscriptionHandle {} 8 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/fts_index_wrong_type.realm.dart: -------------------------------------------------------------------------------- 1 | // MOCK FILE! This file exists to ensure the parent file is valid Dart. 2 | // The parent will be used as input to the realm_generator in a test, and the 3 | // output compared to the .expected file. 4 | part of 'fts_index_wrong_type.dart'; 5 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/illigal_constructor.realm.dart: -------------------------------------------------------------------------------- 1 | // MOCK FILE! This file exists to ensure the parent file is valid Dart. 2 | // The parent will be used as input to the realm_generator in a test, and the 3 | // output compared to the .expected file. 4 | part of 'illigal_constructor.dart'; 5 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/list_of_list_not_supported.dart: -------------------------------------------------------------------------------- 1 | import 'package:realm_common/realm_common.dart'; 2 | 3 | part 'list_of_list_not_supported.realm.dart'; 4 | 5 | @RealmModel() 6 | class _Bad { 7 | late int x; 8 | var listOfLists = [ 9 | [0], 10 | [1] 11 | ]; 12 | } 13 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/long_mapped_to_name.realm.dart: -------------------------------------------------------------------------------- 1 | // MOCK FILE! This file exists to ensure the parent file is valid Dart. 2 | // The parent will be used as input to the realm_generator in a test, and the 3 | // output compared to the .expected file. 4 | part of 'long_mapped_to_name.dart'; 5 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/nullable_realm_value.realm.dart: -------------------------------------------------------------------------------- 1 | // MOCK FILE! This file exists to ensure the parent file is valid Dart. 2 | // The parent will be used as input to the realm_generator in a test, and the 3 | // output compared to the .expected file. 4 | part of 'nullable_realm_value.dart'; 5 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/repeated_field_annotations.dart: -------------------------------------------------------------------------------- 1 | import 'package:realm_common/realm_common.dart'; 2 | 3 | part 'repeated_field_annotations.realm.dart'; 4 | 5 | @RealmModel() 6 | class _Bad { 7 | @PrimaryKey() 8 | @MapTo('key') 9 | @PrimaryKey() 10 | late int id; 11 | } 12 | -------------------------------------------------------------------------------- /packages/realm_generator/test/good_test_data/embedded_annotations.realm.dart: -------------------------------------------------------------------------------- 1 | // MOCK FILE! This file exists to ensure the parent file is valid Dart. 2 | // The parent will be used as input to the realm_generator in a test, and the 3 | // output compared to the .expected file. 4 | part of 'embedded_annotations.dart'; 5 | -------------------------------------------------------------------------------- /packages/realm_generator/test/good_test_data/list_initialization.realm.dart: -------------------------------------------------------------------------------- 1 | // MOCK FILE! This file exists to ensure the parent file is valid Dart. 2 | // The parent will be used as input to the realm_generator in a test, and the 3 | // output compared to the .expected file. 4 | part of 'list_initialization.dart'; 5 | -------------------------------------------------------------------------------- /packages/realm_generator/test/good_test_data/user_defined_getter.realm.dart: -------------------------------------------------------------------------------- 1 | // MOCK FILE! This file exists to ensure the parent file is valid Dart. 2 | // The parent will be used as input to the realm_generator in a test, and the 3 | // output compared to the .expected file. 4 | part of 'user_defined_getter.dart'; 5 | -------------------------------------------------------------------------------- /packages/realm_dart/dev/README.md: -------------------------------------------------------------------------------- 1 | # dev 2 | A cli helper tool for realm_dart development 3 | 4 | ## Install 5 | Either run `melos setup` or change to the directory of this README, then: 6 | ```shell 7 | dart pub global activate --source path . 8 | ``` 9 | As for all dart tools ensure that `~/.pub_cache/bin` is in your path -------------------------------------------------------------------------------- /packages/realm_dart/lib/src/handles/map_changes_handle.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2024 MongoDB, Inc. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import '../collections.dart'; 5 | import 'handle_base.dart'; 6 | 7 | abstract interface class MapChangesHandle extends HandleBase { 8 | MapChanges get changes; 9 | } 10 | -------------------------------------------------------------------------------- /packages/realm_dart/lib/src/handles/native/ffi.dart: -------------------------------------------------------------------------------- 1 | // Import this file instead of package:ffi/ffi.dart 2 | // Hides StringUtf8Pointer.toNativeUtf8 and StringUtf16Pointer since these allows 3 | // silently allocating memory. Use toUtf8Ptr instead 4 | export 'package:ffi/ffi.dart' hide StringUtf8Pointer, StringUtf16Pointer; 5 | -------------------------------------------------------------------------------- /packages/realm_dart/lib/src/handles/object_changes_handle.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2024 MongoDB, Inc. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import 'handle_base.dart'; 5 | 6 | abstract interface class ObjectChangesHandle extends HandleBase { 7 | bool get isDeleted; 8 | List get properties; 9 | } 10 | -------------------------------------------------------------------------------- /packages/realm_dart/lib/src/handles/web/object_changes_handle.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2024 MongoDB, Inc. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import '../object_changes_handle.dart' as intf; 5 | import 'handle_base.dart'; 6 | 7 | class ObjectChangesHandle extends HandleBase implements intf.ObjectChangesHandle {} 8 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/backlink_illegal_symbol.realm.dart: -------------------------------------------------------------------------------- 1 | // MOCK FILE! This file exists to ensure the parent file is valid Dart. 2 | // The parent will be used as input to the realm_generator in a test, and the 3 | // output compared to the .expected file. 4 | part of 'backlink_illegal_symbol.dart'; 5 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/backlink_unknown_symbol.realm.dart: -------------------------------------------------------------------------------- 1 | // MOCK FILE! This file exists to ensure the parent file is valid Dart. 2 | // The parent will be used as input to the realm_generator in a test, and the 3 | // output compared to the .expected file. 4 | part of 'backlink_unknown_symbol.dart'; 5 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/not_an_indexable_type.realm.dart: -------------------------------------------------------------------------------- 1 | // MOCK FILE! This file exists to ensure the parent file is valid Dart. 2 | // The parent will be used as input to the realm_generator in a test, and the 3 | // output compared to the .expected file. 4 | part of 'not_an_indexable_type.dart'; 5 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/nullable_list_elements.realm.dart: -------------------------------------------------------------------------------- 1 | // MOCK FILE! This file exists to ensure the parent file is valid Dart. 2 | // The parent will be used as input to the realm_generator in a test, and the 3 | // output compared to the .expected file. 4 | part of 'nullable_list_elements.dart'; 5 | -------------------------------------------------------------------------------- /packages/realm_dart/scripts/cmake-build-xcode.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -eo pipefail 4 | 5 | XCODEBUILD_ARGS=() 6 | for arg in "$@" 7 | do 8 | if [ "$arg" = "-target" ]; then 9 | arg="-scheme" 10 | fi 11 | XCODEBUILD_ARGS+=("$arg") 12 | done 13 | 14 | xcodebuild "${XCODEBUILD_ARGS[@]}" 15 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/backlink_unknown_symbol.dart: -------------------------------------------------------------------------------- 1 | import 'package:realm_common/realm_common.dart'; 2 | 3 | @RealmModel() 4 | class _Source { 5 | _Target? target; 6 | } 7 | 8 | @RealmModel() 9 | class _Target { 10 | @Backlink(#unknownSymbol) 11 | late Iterable<_Source> backlinks; 12 | } 13 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/invalid_model_name_prefix.realm.dart: -------------------------------------------------------------------------------- 1 | // MOCK FILE! This file exists to ensure the parent file is valid Dart. 2 | // The parent will be used as input to the realm_generator in a test, and the 3 | // output compared to the .expected file. 4 | part of 'invalid_model_name_prefix.dart'; 5 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/long_mapped_to_name.dart: -------------------------------------------------------------------------------- 1 | import 'package:realm_common/realm_common.dart'; 2 | 3 | part 'long_mapped_to_name.realm.dart'; 4 | 5 | @RealmModel() 6 | @MapTo('ThisIsAVeryLongClassNameSoLongInFactThatItRunsOverThe57CharacterLimit') 7 | class _Foo { 8 | late int id; 9 | } 10 | -------------------------------------------------------------------------------- /packages/realm_generator/test/good_test_data/binary_type.dart: -------------------------------------------------------------------------------- 1 | import 'dart:typed_data'; 2 | 3 | import 'package:realm_common/realm_common.dart'; 4 | 5 | part 'binary_type.realm.dart'; 6 | 7 | @RealmModel() 8 | class _Foo { 9 | late Uint8List requiredBinaryProp; 10 | late Uint8List? nullableBinaryProp; 11 | } 12 | -------------------------------------------------------------------------------- /packages/realm_generator/test/info_test_data/primary_key_always_indexed.dart: -------------------------------------------------------------------------------- 1 | import 'package:realm_common/realm_common.dart'; 2 | 3 | part 'primary_key_always_indexed.realm.dart'; 4 | 5 | @RealmModel() 6 | class _Questionable { 7 | @PrimaryKey() 8 | @Indexed() 9 | late int primaryKeysAreAlwaysIndexed; 10 | } 11 | -------------------------------------------------------------------------------- /packages/realm_generator/test/info_test_data/primary_key_always_indexed.realm.dart: -------------------------------------------------------------------------------- 1 | // MOCK FILE! This file exists to ensure the parent file is valid Dart. 2 | // The parent will be used as input to the realm_generator in a test, and the 3 | // output compared to the .expected file. 4 | part of 'primary_key_always_indexed.dart'; 5 | -------------------------------------------------------------------------------- /packages/realm/ios/Classes/realm_plugin.h: -------------------------------------------------------------------------------- 1 | #ifndef FLUTTER_PLUGIN_REALM_PLUGIN_H_ 2 | #define FLUTTER_PLUGIN_REALM_PLUGIN_H_ 3 | 4 | #ifdef __cplusplus 5 | #define RLM_API extern "C" __attribute__((visibility("default"))) 6 | #else 7 | #define RLM_API 8 | #endif // __cplusplus 9 | 10 | #endif // FLUTTER_PLUGIN_REALM_PLUGIN_H_ -------------------------------------------------------------------------------- /packages/realm_dart/lib/src/handles/web/subscription_set_handle.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2024 MongoDB, Inc. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import '../subscription_set_handle.dart' as intf; 5 | import 'handle_base.dart'; 6 | 7 | class SubscriptionSetHandle extends HandleBase implements intf.SubscriptionSetHandle {} 8 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/backlink_illegal_symbol.dart: -------------------------------------------------------------------------------- 1 | import 'package:realm_common/realm_common.dart'; 2 | 3 | @RealmModel() 4 | class _NotASource { 5 | late int notALink; 6 | } 7 | 8 | @RealmModel() 9 | class _Target { 10 | @Backlink(#notALink) 11 | late Iterable<_NotASource> backlinks; 12 | } 13 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/backlink_incompatible_type.realm.dart: -------------------------------------------------------------------------------- 1 | // MOCK FILE! This file exists to ensure the parent file is valid Dart. 2 | // The parent will be used as input to the realm_generator in a test, and the 3 | // output compared to the .expected file. 4 | part of 'backlink_incompatible_type.dart'; 5 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/defining_both_class_prefixes.realm.dart: -------------------------------------------------------------------------------- 1 | // MOCK FILE! This file exists to ensure the parent file is valid Dart. 2 | // The parent will be used as input to the realm_generator in a test, and the 3 | // output compared to the .expected file. 4 | part of 'defining_both_class_prefixes.dart'; 5 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/embedded_object_primary_key.realm.dart: -------------------------------------------------------------------------------- 1 | // MOCK FILE! This file exists to ensure the parent file is valid Dart. 2 | // The parent will be used as input to the realm_generator in a test, and the 3 | // output compared to the .expected file. 4 | part of 'embedded_object_primary_key.dart'; 5 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/list_of_list_not_supported.realm.dart: -------------------------------------------------------------------------------- 1 | // MOCK FILE! This file exists to ensure the parent file is valid Dart. 2 | // The parent will be used as input to the realm_generator in a test, and the 3 | // output compared to the .expected file. 4 | part of 'list_of_list_not_supported.dart'; 5 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/repeated_class_annotations.realm.dart: -------------------------------------------------------------------------------- 1 | // MOCK FILE! This file exists to ensure the parent file is valid Dart. 2 | // The parent will be used as input to the realm_generator in a test, and the 3 | // output compared to the .expected file. 4 | part of 'repeated_class_annotations.dart'; 5 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/repeated_field_annotations.realm.dart: -------------------------------------------------------------------------------- 1 | // MOCK FILE! This file exists to ensure the parent file is valid Dart. 2 | // The parent will be used as input to the realm_generator in a test, and the 3 | // output compared to the .expected file. 4 | part of 'repeated_field_annotations.dart'; 5 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/unsupported_non_realm_type_set.dart: -------------------------------------------------------------------------------- 1 | import 'package:realm_common/realm_common.dart'; 2 | 3 | part 'unsupported_non_realm_type_set.realm.dart'; 4 | 5 | @RealmModel() 6 | class _Bad { 7 | @PrimaryKey() 8 | late int id; 9 | 10 | late Set wrong; 11 | } 12 | -------------------------------------------------------------------------------- /packages/realm/macos/Classes/realm_plugin.h: -------------------------------------------------------------------------------- 1 | #ifndef FLUTTER_PLUGIN_REALM_PLUGIN_H_ 2 | #define FLUTTER_PLUGIN_REALM_PLUGIN_H_ 3 | 4 | #ifdef __cplusplus 5 | #define RLM_API extern "C" __attribute__((visibility("default"))) 6 | #else 7 | #define RLM_API 8 | #endif // __cplusplus 9 | 10 | #endif // FLUTTER_PLUGIN_REALM_PLUGIN_H_ -------------------------------------------------------------------------------- /packages/realm/tests/ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /packages/realm/tests/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /packages/realm_dart/lib/src/handles/web/collection_changes_handle.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2024 MongoDB, Inc. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import '../collection_changes_handle.dart' as intf; 5 | import 'handle_base.dart'; 6 | 7 | class CollectionChangesHandle extends HandleBase implements intf.CollectionChangesHandle {} 8 | -------------------------------------------------------------------------------- /packages/realm_dart/lib/src/handles/web/notification_token_handle.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2024 MongoDB, Inc. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import '../notification_token_handle.dart' as intf; 5 | import 'handle_base.dart'; 6 | 7 | class NotificationTokenHandle extends HandleBase implements intf.NotificationTokenHandle {} 8 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/unsupported_non_realm_type_set.realm.dart: -------------------------------------------------------------------------------- 1 | // MOCK FILE! This file exists to ensure the parent file is valid Dart. 2 | // The parent will be used as input to the realm_generator in a test, and the 3 | // output compared to the .expected file. 4 | part of 'unsupported_non_realm_type_set.dart'; 5 | -------------------------------------------------------------------------------- /packages/realm_generator/test/good_test_data/user_defined_getter.dart: -------------------------------------------------------------------------------- 1 | import 'package:realm_common/realm_common.dart'; 2 | 3 | part 'user_defined_getter.realm.dart'; 4 | 5 | @RealmModel() 6 | class _Person { 7 | late String name; 8 | String get lastName => name.split(' ').first; // <-- should be ignored by generator 9 | } 10 | -------------------------------------------------------------------------------- /packages/realm/tests/macos/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /packages/realm_dart/lib/src/handles/collection_changes_handle.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2024 MongoDB, Inc. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import '../collections.dart'; 5 | import 'handle_base.dart'; 6 | 7 | abstract interface class CollectionChangesHandle extends HandleBase { 8 | CollectionChanges get changes; 9 | } 10 | -------------------------------------------------------------------------------- /packages/realm_dart/lib/src/handles/default_client.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2024 MongoDB, Inc. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import 'package:http/http.dart'; 5 | 6 | import 'native/default_client.dart' if (dart.library.js_interop) 'web/default_client.dart' as impl; 7 | 8 | final Client defaultClient = impl.defaultClient(); 9 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/bool_not_allowed_as_primary_key.realm.dart: -------------------------------------------------------------------------------- 1 | // MOCK FILE! This file exists to ensure the parent file is valid Dart. 2 | // The parent will be used as input to the realm_generator in a test, and the 3 | // output compared to the .expected file. 4 | part of 'bool_not_allowed_as_primary_key.dart'; 5 | -------------------------------------------------------------------------------- /packages/realm/tests/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /packages/realm/tests/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/non_nullable_realm_object_reference.realm.dart: -------------------------------------------------------------------------------- 1 | // MOCK FILE! This file exists to ensure the parent file is valid Dart. 2 | // The parent will be used as input to the realm_generator in a test, and the 3 | // output compared to the .expected file. 4 | part of 'non_nullable_realm_object_reference.dart'; 5 | -------------------------------------------------------------------------------- /packages/realm_generator/test/good_test_data/required_argument_with_default_value.realm.dart: -------------------------------------------------------------------------------- 1 | // MOCK FILE! This file exists to ensure the parent file is valid Dart. 2 | // The parent will be used as input to the realm_generator in a test, and the 3 | // output compared to the .expected file. 4 | part of 'required_argument_with_default_value.dart'; 5 | -------------------------------------------------------------------------------- /packages/realm/ios/Classes/platform.mm: -------------------------------------------------------------------------------- 1 | #import "realm_plugin.h" 2 | 3 | #include 4 | #include 5 | 6 | 7 | #ifndef BUNDLE_ID 8 | #define BUNDLE_ID "realm_bundle_id" 9 | #endif 10 | 11 | static std::string bundleId = BUNDLE_ID; 12 | 13 | RLM_API const char* realm_dart_get_bundle_id() { 14 | return bundleId.c_str(); 15 | } -------------------------------------------------------------------------------- /packages/realm_dart/scripts/build.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | 3 | @REM Output is in PROJECT_ROOT\binary directory 4 | @REM example usage: ....\realm-dart>scripts\build.bat 5 | 6 | @REM Start in the root directory of the project. 7 | pushd "%~dp0.." 8 | echo %CD% 9 | 10 | cmake --preset windows 11 | cmake --build --preset windows --config MinSizeRel 12 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/realm_object_reference_default_values.realm.dart: -------------------------------------------------------------------------------- 1 | // MOCK FILE! This file exists to ensure the parent file is valid Dart. 2 | // The parent will be used as input to the realm_generator in a test, and the 3 | // output compared to the .expected file. 4 | part of 'realm_object_reference_default_values.dart'; 5 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/realm_value_not_allowed_as_primary_key.realm.dart: -------------------------------------------------------------------------------- 1 | // MOCK FILE! This file exists to ensure the parent file is valid Dart. 2 | // The parent will be used as input to the realm_generator in a test, and the 3 | // output compared to the .expected file. 4 | part of 'realm_value_not_allowed_as_primary_key.dart'; 5 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/unsupported_realm_set_of_nullable_realmobject.dart: -------------------------------------------------------------------------------- 1 | import 'package:realm_common/realm_common.dart'; 2 | 3 | part 'unsupported_realm_set_of_nullable_realmobject.realm.dart'; 4 | 5 | @RealmModel() 6 | class _Bad { 7 | @PrimaryKey() 8 | late int id; 9 | 10 | late Set<_Bad?> wrong1; 11 | } 12 | -------------------------------------------------------------------------------- /packages/realm_generator/test/good_test_data/another_mapto.dart: -------------------------------------------------------------------------------- 1 | import 'package:realm_common/realm_common.dart'; 2 | import 'mapto.dart'; 3 | 4 | part 'another_mapto.realm.dart'; 5 | 6 | @RealmModel() 7 | @MapTo('this is also mapped') 8 | class _MappedToo { 9 | late $Original? singleLink; 10 | 11 | late List<$Original> listLink; 12 | } 13 | -------------------------------------------------------------------------------- /packages/ejson/lib/ejson.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2023 MongoDB, Inc. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | export 'src/configuration.dart'; 5 | export 'src/decoding.dart' hide customDecoders; 6 | export 'src/encoding.dart' hide customEncoders; 7 | export 'src/types.dart'; 8 | 9 | export 'package:ejson_annotation/ejson_annotation.dart'; 10 | -------------------------------------------------------------------------------- /packages/realm/tests/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /packages/realm/tests/macos/Flutter/GeneratedPluginRegistrant.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | import FlutterMacOS 6 | import Foundation 7 | 8 | import realm 9 | 10 | func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { 11 | RealmPlugin.register(with: registry.registrar(forPlugin: "RealmPlugin")) 12 | } 13 | -------------------------------------------------------------------------------- /packages/realm_dart/.pubignore: -------------------------------------------------------------------------------- 1 | # Ignore native code 2 | /CMakeLists.txt 3 | /CMakePresets.json 4 | /src/ 5 | 6 | # Ignore build tools 7 | /scripts/ 8 | /tool/ 9 | /dev/ 10 | /ffigen.yaml 11 | 12 | # Ignore test resources 13 | /test/ 14 | 15 | # Repeated from .gitignore *sigh* 16 | /binary/ 17 | /build-native/ 18 | /mongodb-realm/ 19 | *.realm.* 20 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/asymmetric_external_link.dart: -------------------------------------------------------------------------------- 1 | import 'package:realm_common/realm_common.dart'; 2 | 3 | @RealmModel(ObjectType.asymmetricObject) 4 | class _Asymmetric { 5 | @PrimaryKey() 6 | @MapTo('_id') 7 | late ObjectId id; 8 | } 9 | 10 | @RealmModel() 11 | class _Bad { 12 | _Asymmetric? asymmetric; 13 | } 14 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/backlink_annotation_on_invalid_iterable.realm.dart: -------------------------------------------------------------------------------- 1 | // MOCK FILE! This file exists to ensure the parent file is valid Dart. 2 | // The parent will be used as input to the realm_generator in a test, and the 3 | // output compared to the .expected file. 4 | part of 'backlink_annotation_on_invalid_iterable.dart'; 5 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/missing_underscore.dart: -------------------------------------------------------------------------------- 1 | import 'package:realm_common/realm_common.dart'; 2 | 3 | part 'missing_underscore.realm.dart'; 4 | 5 | @RealmModel() 6 | class _Bad { 7 | late Other other; 8 | } 9 | 10 | @RealmModel() 11 | class _Other {} 12 | 13 | class Other extends _Other {} // mock class for testing 14 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/unsupported_realm_set_of_nullable_realmvalue.dart: -------------------------------------------------------------------------------- 1 | import 'package:realm_common/realm_common.dart'; 2 | 3 | part 'unsupported_realm_set_of_nullable_realmvalue.realm.dart'; 4 | 5 | @RealmModel() 6 | class _Bad { 7 | @PrimaryKey() 8 | late int id; 9 | 10 | late Set wrong1; 11 | } 12 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/unsupported_realm_set_with_default_values.dart: -------------------------------------------------------------------------------- 1 | import 'package:realm_common/realm_common.dart'; 2 | 3 | part 'unsupported_realm_set_with_default_values.realm.dart'; 4 | 5 | @RealmModel() 6 | class _Bad { 7 | @PrimaryKey() 8 | late int id; 9 | 10 | late Set wrong1 = {true, false}; 11 | } 12 | -------------------------------------------------------------------------------- /packages/ejson_lint/example/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: example 2 | description: A sample command-line application. 3 | version: 1.0.0 4 | 5 | publish_to: none 6 | 7 | environment: 8 | sdk: ^3.6.0 9 | 10 | dependencies: 11 | ejson_annotation: ^0.4.0 12 | 13 | dev_dependencies: 14 | custom_lint: ^0.7.1 15 | ejson_lint: ^0.4.0 16 | lints: ^5.1.1 17 | -------------------------------------------------------------------------------- /packages/realm_dart/lib/src/handles/web/mutable_subscription_set_handle.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2024 MongoDB, Inc. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import '../mutable_subscription_set_handle.dart' as intf; 5 | import 'handle_base.dart'; 6 | 7 | class MutableSubscriptionSetHandle extends HandleBase implements intf.MutableSubscriptionSetHandle {} 8 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/backlink_annotation_on_incompatible_field.realm.dart: -------------------------------------------------------------------------------- 1 | // MOCK FILE! This file exists to ensure the parent file is valid Dart. 2 | // The parent will be used as input to the realm_generator in a test, and the 3 | // output compared to the .expected file. 4 | part of 'backlink_annotation_on_incompatible_field.dart'; 5 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/nullable_set.expected: -------------------------------------------------------------------------------- 1 | Realm sets cannot be nullable 2 | 3 | in: asset:pkg/test/error_test_data/nullable_set.dart:10:3 4 | ╷ 5 | 5 │ @RealmModel() 6 | 6 │ class _Bad { 7 | │ ━━━━ in realm model for 'Bad' 8 | ... │ 9 | 10 │ Set? wrong; 10 | │ ^^^^^^^^^ is nullable 11 | ╵ 12 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/unsupported_realm_set_with_default_values.realm.dart: -------------------------------------------------------------------------------- 1 | // MOCK FILE! This file exists to ensure the parent file is valid Dart. 2 | // The parent will be used as input to the realm_generator in a test, and the 3 | // output compared to the .expected file. 4 | part of 'unsupported_realm_set_with_default_values.dart'; 5 | -------------------------------------------------------------------------------- /packages/realm_generator/test/good_test_data/private_fields.dart: -------------------------------------------------------------------------------- 1 | // ignore_for_file: unused_element, prefer_final_fields, unused_field 2 | 3 | import 'package:realm_common/realm_common.dart'; 4 | 5 | part 'private_fields.realm.dart'; 6 | 7 | @RealmModel() 8 | class _WithPrivateFields { 9 | late String _plain; 10 | int _withDefault = 0; 11 | } 12 | -------------------------------------------------------------------------------- /packages/realm/tests/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /packages/realm/tests/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/invalid_model_name_prefix.expected: -------------------------------------------------------------------------------- 1 | Missing prefix on realm model name 2 | 3 | in: asset:pkg/test/error_test_data/invalid_model_name_prefix.dart:6:7 4 | ╷ 5 | 5 │ @RealmModel() 6 | 6 │ class Bad { 7 | │ ^^^ missing prefix 8 | ╵ 9 | Align class name to match prefix [_$] (regular expression), 10 | 11 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/nullable_list.expected: -------------------------------------------------------------------------------- 1 | Realm lists cannot be nullable 2 | 3 | in: asset:pkg/test/error_test_data/nullable_list.dart:10:3 4 | ╷ 5 | 5 │ @RealmModel() 6 | 6 │ class _Bad { 7 | │ ━━━━ in realm model for 'Bad' 8 | ... │ 9 | 10 │ List? wrong; 10 | │ ^^^^^^^^^^ is nullable 11 | ╵ 12 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/unsupported_realm_set_of_nullable_realmobject.realm.dart: -------------------------------------------------------------------------------- 1 | // MOCK FILE! This file exists to ensure the parent file is valid Dart. 2 | // The parent will be used as input to the realm_generator in a test, and the 3 | // output compared to the .expected file. 4 | part of 'unsupported_realm_set_of_nullable_realmobject.dart'; 5 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/unsupported_realm_set_of_nullable_realmvalue.realm.dart: -------------------------------------------------------------------------------- 1 | // MOCK FILE! This file exists to ensure the parent file is valid Dart. 2 | // The parent will be used as input to the realm_generator in a test, and the 3 | // output compared to the .expected file. 4 | part of 'unsupported_realm_set_of_nullable_realmvalue.dart'; 5 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/non_nullable_realm_object_reference.dart: -------------------------------------------------------------------------------- 1 | import 'package:realm_common/realm_common.dart'; 2 | 3 | part 'non_nullable_realm_object_reference.realm.dart'; 4 | 5 | @RealmModel() 6 | class _Other {} 7 | 8 | @RealmModel() 9 | class _Bad { 10 | @PrimaryKey() 11 | late int id; 12 | 13 | late _Other wrong; 14 | } 15 | -------------------------------------------------------------------------------- /packages/realm/.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: e6b34c2b5c96bb95325269a29a84e83ed8909b5f 8 | channel: stable 9 | 10 | project_type: plugin 11 | -------------------------------------------------------------------------------- /packages/realm_dart/scripts/launch-c.in: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Xcode generator doesn't include the compiler as the 4 | # first argument, Ninja and Makefiles do. Handle both cases. 5 | if [[ "$1" = "${CMAKE_C_COMPILER}" ]] ; then 6 | shift 7 | fi 8 | 9 | echo "Realm: Launching C compiler" 10 | export CCACHE_CPP2=true 11 | exec "${C_LAUNCHER}" "${CMAKE_C_COMPILER}" "$@" -------------------------------------------------------------------------------- /packages/realm_dart/src/dart-dl/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(dart-dl OBJECT 2 | dart_api_dl.c 3 | dart_api_dl.h 4 | dart_api.h 5 | dart_native_api.h 6 | dart_version.h 7 | internal/dart_api_dl_impl.h 8 | ) 9 | 10 | target_include_directories(dart-dl PUBLIC 11 | ${CMAKE_CURRENT_SOURCE_DIR} 12 | ${CMAKE_CURRENT_SOURCE_DIR}/internal 13 | ) 14 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/asymmetric_missing_pk.expected: -------------------------------------------------------------------------------- 1 | Asymmetric objects must have a primary key named _id 2 | 3 | in: asset:pkg/test/error_test_data/asymmetric_missing_pk.dart:4:7 4 | ╷ 5 | 3 │ @RealmModel(ObjectType.asymmetricObject) 6 | 4 │ class _BadAsymmetric { 7 | │ ^^^^^^^^^^^^^^ 8 | ╵ 9 | Add a primary key named _id 10 | 11 | -------------------------------------------------------------------------------- /packages/realm/example/.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: ffb2ecea5223acdd139a5039be2f9c796962833d 8 | channel: stable 9 | 10 | project_type: app 11 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/nullable_list_elements.dart: -------------------------------------------------------------------------------- 1 | import 'package:realm_common/realm_common.dart'; 2 | 3 | part 'nullable_list_elements.realm.dart'; 4 | 5 | @RealmModel() 6 | class _Other {} 7 | 8 | @RealmModel() 9 | class _Bad { 10 | @PrimaryKey() 11 | late int id; 12 | 13 | late List okay; 14 | late List<_Other?> wrong; 15 | } 16 | -------------------------------------------------------------------------------- /packages/realm_dart/scripts/launch-cxx.in: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Xcode generator doesn't include the compiler as the 4 | # first argument, Ninja and Makefiles do. Handle both cases. 5 | if [[ "$1" = "${CMAKE_CXX_COMPILER}" ]] ; then 6 | shift 7 | fi 8 | 9 | echo "Realm: Launching CXX compiler" 10 | export CCACHE_CPP2=true 11 | exec "${CXX_LAUNCHER}" "${CMAKE_CXX_COMPILER}" "$@" -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/realm_object_reference_default_values.dart: -------------------------------------------------------------------------------- 1 | import 'package:realm_common/realm_common.dart'; 2 | 3 | part 'realm_object_reference_default_values.realm.dart'; 4 | 5 | @RealmModel() 6 | class _Person { 7 | int x = 0; 8 | late _Person? parent = Person(); 9 | } 10 | 11 | class Person extends _Person {} // mock class for testing 12 | -------------------------------------------------------------------------------- /packages/ejson_generator/lib/src/builder.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2023 MongoDB, Inc. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import 'package:build/build.dart'; 5 | import 'package:source_gen/source_gen.dart'; 6 | 7 | import 'generator.dart'; 8 | 9 | Builder getEJsonGenerator([BuilderOptions? options]) { 10 | return SharedPartBuilder([EJsonGenerator()], 'ejson'); 11 | } 12 | -------------------------------------------------------------------------------- /packages/realm_dart/test/utils/web/platform_util.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2024 MongoDB, Inc. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import '../platform_util.dart' as intf; 5 | 6 | class PlatformUtil implements intf.PlatformUtil { 7 | const PlatformUtil(); 8 | 9 | @override 10 | noSuchMethod(Invocation invocation) => throw UnsupportedError('web not supported'); 11 | } 12 | -------------------------------------------------------------------------------- /packages/realm/tests/ios/RunnerTests/RunnerTests.swift: -------------------------------------------------------------------------------- 1 | import Flutter 2 | import UIKit 3 | import XCTest 4 | 5 | class RunnerTests: XCTestCase { 6 | 7 | func testExample() { 8 | // If you add code to the Runner application, consider adding tests here. 9 | // See https://developer.apple.com/documentation/xctest for more information about using XCTest. 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /packages/realm/tests/macos/Runner/Release.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.network.client 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /packages/realm/tests/macos/RunnerTests/RunnerTests.swift: -------------------------------------------------------------------------------- 1 | import FlutterMacOS 2 | import Cocoa 3 | import XCTest 4 | 5 | class RunnerTests: XCTestCase { 6 | 7 | func testExample() { 8 | // If you add code to the Runner application, consider adding tests here. 9 | // See https://developer.apple.com/documentation/xctest for more information about using XCTest. 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/double_primary_key.dart: -------------------------------------------------------------------------------- 1 | import 'package:realm_common/realm_common.dart'; 2 | 3 | part 'double_primary_key.realm.dart'; 4 | 5 | @RealmModel() 6 | class _Bad { 7 | @PrimaryKey() 8 | late int first; 9 | 10 | @PrimaryKey() 11 | late String second; 12 | 13 | late String another; 14 | 15 | @PrimaryKey() 16 | late String third; 17 | } 18 | -------------------------------------------------------------------------------- /packages/realm_generator/lib/src/annotation_value.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2021 MongoDB, Inc. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import 'package:analyzer/dart/ast/ast.dart'; 5 | import 'package:analyzer/dart/constant/value.dart'; 6 | 7 | class AnnotationValue { 8 | final Annotation annotation; 9 | final DartObject value; 10 | AnnotationValue(this.annotation, this.value); 11 | } 12 | -------------------------------------------------------------------------------- /packages/realm_dart/lib/src/handles/web/handle_base.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2024 MongoDB, Inc. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import '../handle_base.dart' as intf; 5 | import 'web_not_supported.dart'; 6 | 7 | export 'web_not_supported.dart'; 8 | 9 | class HandleBase implements intf.HandleBase { 10 | @override 11 | noSuchMethod(Invocation invocation) => webNotSupported(); 12 | } 13 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/backlink_incompatible_type.dart: -------------------------------------------------------------------------------- 1 | import 'package:realm_common/realm_common.dart'; 2 | 3 | @RealmModel() 4 | class _IncompatibleSource { 5 | _AnotherTarget? target; 6 | } 7 | 8 | @RealmModel() 9 | class _Target { 10 | @Backlink(#target) 11 | late Iterable<_IncompatibleSource> backlinks; 12 | } 13 | 14 | @RealmModel() 15 | class _AnotherTarget {} 16 | -------------------------------------------------------------------------------- /packages/realm/tests/windows/flutter/generated_plugin_registrant.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #include "generated_plugin_registrant.h" 8 | 9 | #include 10 | 11 | void RegisterPlugins(flutter::PluginRegistry* registry) { 12 | RealmPluginRegisterWithRegistrar( 13 | registry->GetRegistrarForPlugin("RealmPlugin")); 14 | } 15 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/asymmetric_external_link.expected: -------------------------------------------------------------------------------- 1 | Linking to asymmetric objects is not allowed 2 | 3 | in: asset:pkg/test/error_test_data/asymmetric_external_link.dart:12:16 4 | ╷ 5 | 10 │ @RealmModel() 6 | 11 │ class _Bad { 7 | │ ━━━━ in realm model for 'Bad' 8 | 12 │ _Asymmetric? asymmetric; 9 | │ ^^^^^^^^^^ ! 10 | ╵ 11 | Remove the field 12 | 13 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/illigal_constructor.expected: -------------------------------------------------------------------------------- 1 | No constructors allowed on realm model classes 2 | 3 | in: asset:pkg/test/error_test_data/illigal_constructor.dart:10:3 4 | ╷ 5 | 5 │ @RealmModel() 6 | 6 │ class _Bad { 7 | │ ━━━━ in realm model for 'Bad' 8 | ... │ 9 | 10 │ _Bad(this.id); 10 | │ ^^^^ has constructor 11 | ╵ 12 | Remove constructor 13 | 14 | -------------------------------------------------------------------------------- /packages/realm/tests/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md: -------------------------------------------------------------------------------- 1 | # Launch Screen Assets 2 | 3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory. 4 | 5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. -------------------------------------------------------------------------------- /packages/realm_dart/lib/src/handles/web/realm_handle.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2024 MongoDB, Inc. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import 'package:realm_dart/realm.dart'; 5 | 6 | import '../realm_handle.dart' as intf; 7 | import 'handle_base.dart'; 8 | 9 | class RealmHandle extends HandleBase implements intf.RealmHandle { 10 | factory RealmHandle.open(Configuration config) => webNotSupported(); 11 | } 12 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/repeated_class_annotations.expected: -------------------------------------------------------------------------------- 1 | Repeated annotation 2 | 3 | in: asset:pkg/test/error_test_data/repeated_class_annotations.dart:7:1 4 | ╷ 5 | 5 │ @RealmModel() 6 | │ ━━━━━━━━━━━━━ 7 | ... │ 8 | 7 │ @RealmModel() 9 | │ ^^^^^^^^^^^^^ duplicated annotation 10 | 8 │ class _Bad {} 11 | ╵ 12 | Remove all duplicated @RealmModel() annotations. 13 | 14 | -------------------------------------------------------------------------------- /.github/workflows/auto-assign.yml: -------------------------------------------------------------------------------- 1 | # NOTE: This is a common file that is overwritten by realm/ci-actions sync service 2 | # and should only be modified in that repository. 3 | 4 | name: 'Auto Assign' 5 | on: 6 | pull_request: 7 | types: [opened] 8 | 9 | jobs: 10 | add-assignee: 11 | runs-on: ubuntu-latest 12 | steps: 13 | - uses: kentaro-m/auto-assign-action@248761c4feb3917c1b0444e33fad1a50093b9847 14 | -------------------------------------------------------------------------------- /packages/realm_generator/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "name": "Debug", 6 | "type": "dart", 7 | "request": "attach", 8 | "observatoryUri": "http://127.0.0.1:5858", 9 | "packages": "package:realm_generator/builder.dart", 10 | "preLaunchTask": "start debug", 11 | } 12 | ] 13 | } -------------------------------------------------------------------------------- /packages/realm_generator/test/good_test_data/all_named_ctor.dart: -------------------------------------------------------------------------------- 1 | import 'package:realm_common/realm_common.dart'; 2 | 3 | part 'all_named_ctor.realm.dart'; 4 | 5 | const config = GeneratorConfig(ctorStyle: CtorStyle.allNamed); 6 | const realmModel = RealmModel.using(baseType: ObjectType.realmObject, generatorConfig: config); 7 | 8 | @realmModel 9 | class _Person { 10 | late String name; 11 | int age = 42; 12 | } 13 | -------------------------------------------------------------------------------- /packages/realm/tests/linux/flutter/generated_plugin_registrant.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #ifndef GENERATED_PLUGIN_REGISTRANT_ 8 | #define GENERATED_PLUGIN_REGISTRANT_ 9 | 10 | #include 11 | 12 | // Registers Flutter plugins. 13 | void fl_register_plugins(FlPluginRegistry* registry); 14 | 15 | #endif // GENERATED_PLUGIN_REGISTRANT_ 16 | -------------------------------------------------------------------------------- /packages/realm_dart/dev/bin/dev.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2024 MongoDB, Inc. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import 'package:dev/dev.dart' as dev; 5 | import 'package:cli_launcher/cli_launcher.dart'; 6 | Future main(List arguments) async => launchExecutable( 7 | arguments, 8 | LaunchConfig( 9 | name: ExecutableName('dev'), 10 | entrypoint: dev.main, 11 | ), 12 | ); -------------------------------------------------------------------------------- /packages/realm_dart/lib/src/handles/web/realm_core.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2024 MongoDB, Inc. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import '../realm_core.dart' as intf; 5 | import 'web_not_supported.dart'; 6 | 7 | const realmCore = RealmCore(); 8 | 9 | class RealmCore implements intf.RealmCore { 10 | const RealmCore(); 11 | 12 | @override 13 | noSuchMethod(Invocation invocation) => webNotSupported(); 14 | } 15 | -------------------------------------------------------------------------------- /packages/realm_dart/lib/src/handles/web/scheduler_handle.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2024 MongoDB, Inc. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import 'dart:isolate'; 5 | 6 | import '../scheduler_handle.dart' as intf; 7 | import 'handle_base.dart'; 8 | 9 | class SchedulerHandle extends HandleBase implements intf.SchedulerHandle { 10 | factory SchedulerHandle(int isolateId, SendPort sendPort) => webNotSupported(); 11 | } 12 | -------------------------------------------------------------------------------- /packages/realm/tests/windows/flutter/generated_plugin_registrant.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #ifndef GENERATED_PLUGIN_REGISTRANT_ 8 | #define GENERATED_PLUGIN_REGISTRANT_ 9 | 10 | #include 11 | 12 | // Registers Flutter plugins. 13 | void RegisterPlugins(flutter::PluginRegistry* registry); 14 | 15 | #endif // GENERATED_PLUGIN_REGISTRANT_ 16 | -------------------------------------------------------------------------------- /packages/realm_dart/lib/src/handles/web/schema_handle.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2024 MongoDB, Inc. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import 'package:realm_dart/realm.dart'; 5 | 6 | import '../schema_handle.dart' as intf; 7 | import 'handle_base.dart'; 8 | 9 | class SchemaHandle extends HandleBase implements intf.SchemaHandle { 10 | factory SchemaHandle.from(Iterable schema) => webNotSupported(); 11 | } 12 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/const_initializer.expected: -------------------------------------------------------------------------------- 1 | Field initializers must be constant 2 | 3 | in: asset:pkg/test/error_test_data/const_initializer.dart:9:12 4 | ╷ 5 | 7 │ @RealmModel() 6 | 8 │ class _Bad { 7 | │ ━━━━ in realm model for 'Bad' 8 | 9 │ var id = Random().nextInt(1000); 9 | │ ^^^^^^^^^^^^^^^^^^^^^^ Must be const 10 | ╵ 11 | Ensure the default value for field "id" is const -------------------------------------------------------------------------------- /packages/realm_dart/dev/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: dev 2 | description: A sample command-line application. 3 | version: 1.0.0 4 | 5 | publish_to: none 6 | 7 | environment: 8 | sdk: ^3.3.1 9 | 10 | dependencies: 11 | args: ^2.4.2 12 | async: ^2.11.0 13 | cli_launcher: ^0.3.1 14 | collection: ^1.18.0 15 | mason_logger: ^0.3.3 16 | 17 | dev_dependencies: 18 | lints: ^5.1.1 19 | test: ^1.24.0 20 | 21 | executables: 22 | dev: 23 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Ingore build file 2 | .dart_tool/ 3 | 4 | # Dart packages and Flutter plugins should not commit these files 5 | pubspec.lock 6 | .packages 7 | .flutter-plugins 8 | .flutter-plugins-dependencies 9 | build/ 10 | release/ 11 | 12 | # melos 13 | .idea/ 14 | pubspec_overrides.yaml 15 | melos**.iml 16 | 17 | # test 18 | test-results.json 19 | coverage/ 20 | 21 | # docs 22 | doc/api/ 23 | 24 | # custom lint 25 | custom_lint.log 26 | -------------------------------------------------------------------------------- /packages/realm_generator/test/good_test_data/mapto.dart: -------------------------------------------------------------------------------- 1 | import 'package:realm_common/realm_common.dart'; 2 | 3 | part 'mapto.realm.dart'; 4 | 5 | @RealmModel() 6 | @MapTo('another type') 7 | class $Original { 8 | @MapTo('remapped primitive') 9 | int primitiveProperty = 0; 10 | 11 | @MapTo('remapped object') 12 | late $Original? objectProperty; 13 | 14 | @MapTo('remapped list') 15 | late List<$Original> listProperty; 16 | } 17 | -------------------------------------------------------------------------------- /.github/workflows/Issue-Needs-Attention.yml: -------------------------------------------------------------------------------- 1 | # NOTE: This is a common file that is overwritten by realm/ci-actions sync service 2 | # and should only be modified in that repository. 3 | 4 | name: Issue Needs Attention 5 | # This workflow is triggered on issue comments. 6 | on: 7 | issue_comment: 8 | types: created 9 | 10 | jobs: 11 | applyNeedsAttentionLabel: 12 | uses: realm/ci-actions/.github/workflows/issue-needs-attention.yml@main 13 | -------------------------------------------------------------------------------- /packages/realm/tests/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/non_nullable_realm_object_reference.expected: -------------------------------------------------------------------------------- 1 | Realm object references must be nullable 2 | 3 | in: asset:pkg/test/error_test_data/non_nullable_realm_object_reference.dart:13:8 4 | ╷ 5 | 8 │ @RealmModel() 6 | 9 │ class _Bad { 7 | │ ━━━━ in realm model for 'Bad' 8 | ... │ 9 | 13 │ late _Other wrong; 10 | │ ^^^^^^ is not nullable 11 | ╵ 12 | Change type to _Other? 13 | 14 | -------------------------------------------------------------------------------- /packages/realm/tests/android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/backlink_annotation_on_incompatible_field.expected: -------------------------------------------------------------------------------- 1 | Backlink must be an iterable of realm objects 2 | 3 | in: asset:pkg/test/error_test_data/backlink_annotation_on_incompatible_field.dart:6:8 4 | ╷ 5 | 3 │ @RealmModel() 6 | 4 │ class _Foo { 7 | │ ━━━━ in realm model for 'Foo' 8 | 5 │ @Backlink(#bad) 9 | 6 │ late bool bad; 10 | │ ^^^^ bool is not an iterable of realm objects 11 | ╵ 12 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/map_unsupported.expected: -------------------------------------------------------------------------------- 1 | Map is not supported 2 | 3 | in: asset:pkg/test/error_test_data/map_unsupported.dart:7:8 4 | ╷ 5 | 5 │ @RealmModel() 6 | 6 │ class _Person { 7 | │ ━━━━━━━ in realm model for 'Person' 8 | 7 │ late Map relatives; 9 | │ ^^^^^^^^^^^^^^^^^^ Non-String keys are not supported in maps 10 | ╵ 11 | Change the map key type to be String 12 | 13 | -------------------------------------------------------------------------------- /packages/realm/example/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: realm_example 2 | description: Demonstrates how to use the Realm SDK for Flutter. 3 | version: 2.0.0-alpha.2 4 | 5 | publish_to: "none" 6 | 7 | environment: 8 | sdk: ^3.6.0 9 | flutter: ^3.27.0 10 | 11 | dependencies: 12 | flutter: 13 | sdk: flutter 14 | realm: ^3.5.0 15 | characters: ^1.4.0 16 | 17 | dev_dependencies: 18 | flutter_lints: ^5.0.0 19 | 20 | flutter: 21 | uses-material-design: true 22 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/nullable_realm_value.expected: -------------------------------------------------------------------------------- 1 | RealmValue fields cannot be nullable 2 | 3 | in: asset:pkg/test/error_test_data/nullable_realm_value.dart:7:3 4 | ╷ 5 | 5 │ @RealmModel() 6 | 6 │ class _Bad { 7 | │ ━━━━ in realm model for 'Bad' 8 | 7 │ RealmValue? wrong; 9 | │ ^^^^^^^^^^^ RealmValue? is nullable 10 | ╵ 11 | Change type to RealmValue. RealmValue can hold null, but must not be nullable itself. 12 | 13 | -------------------------------------------------------------------------------- /packages/realm_generator/test/info_test_data/primary_key_always_indexed.expected: -------------------------------------------------------------------------------- 1 | [INFO] testBuilder: Indexed is implied for a primary key 2 | 3 | in: asset:pkg/test/info_test_data/primary_key_always_indexed.dart:9:12 4 | ╷ 5 | 7 │ @PrimaryKey() 6 | 8 │ @Indexed() 7 | 9 │ late int primaryKeysAreAlwaysIndexed; 8 | │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ 9 | ╵ 10 | Remove either the @Indexed or @PrimaryKey annotation from 'primaryKeysAreAlwaysIndexed'. 11 | -------------------------------------------------------------------------------- /packages/realm_dart/lib/src/handles/schema_handle.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2024 MongoDB, Inc. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import '../configuration.dart'; 5 | import 'handle_base.dart'; 6 | 7 | import 'native/schema_handle.dart' if (dart.library.js_interop) 'web/schema_handle.dart' as impl; 8 | 9 | abstract interface class SchemaHandle extends HandleBase { 10 | factory SchemaHandle.from(Iterable schema) = impl.SchemaHandle.from; 11 | } 12 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/backlink_annotation_on_invalid_iterable.expected: -------------------------------------------------------------------------------- 1 | Backlink must be an iterable of realm objects 2 | 3 | in: asset:pkg/test/error_test_data/backlink_annotation_on_invalid_iterable.dart:6:8 4 | ╷ 5 | 3 │ @RealmModel() 6 | 4 │ class _Foo { 7 | │ ━━━━ in realm model for 'Foo' 8 | 5 │ @Backlink(#bad) 9 | 6 │ late Iterable bad; 10 | │ ^^^^^^^^^^^^^ Iterable is not an iterable of realm objects 11 | ╵ -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/backlink_unknown_symbol.expected: -------------------------------------------------------------------------------- 1 | Backlink must point to a valid field 2 | 3 | in: asset:pkg/test/error_test_data/backlink_unknown_symbol.dart:11:8 4 | ╷ 5 | 8 │ @RealmModel() 6 | 9 │ class _Target { 7 | │ ━━━━━━━ in realm model for 'Target' 8 | 10 │ @Backlink(#unknownSymbol) 9 | 11 │ late Iterable<_Source> backlinks; 10 | │ ^^^^^^^^^^^^^^^^^ _Source does not have a field named unknownSymbol 11 | ╵ -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/defining_both_class_prefixes.expected: -------------------------------------------------------------------------------- 1 | Duplicate definition 2 | 3 | in: asset:pkg/test/error_test_data/defining_both_class_prefixes.dart:9:7 4 | ╷ 5 | 5 │ @RealmModel() 6 | 6 │ class $Bad1 {} 7 | │ ━━━━━ 8 | ... │ 9 | 8 │ @RealmModel() 10 | 9 │ class _Bad1 {} 11 | │ ^^^^^ realm model '$Bad1' already defines 'Bad1' 12 | ╵ 13 | Duplicate realm model definitions '_Bad1' and '$Bad1'. 14 | 15 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/backlink_illegal_symbol.expected: -------------------------------------------------------------------------------- 1 | Incompatible backlink type 2 | 3 | in: asset:pkg/test/error_test_data/backlink_illegal_symbol.dart:11:8 4 | ╷ 5 | 8 │ @RealmModel() 6 | 9 │ class _Target { 7 | │ ━━━━━━━ in realm model for 'Target' 8 | 10 │ @Backlink(#notALink) 9 | 11 │ late Iterable<_NotASource> backlinks; 10 | │ ^^^^^^^^^^^^^^^^^^^^^ _NotASource.notALink is not a '_Target?' or 'List<_Target>' 11 | ╵ -------------------------------------------------------------------------------- /packages/realm_dart/lib/src/handles/web/app_handle.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2024 MongoDB, Inc. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import '../../../realm.dart'; 5 | import '../app_handle.dart' as intf; 6 | import 'handle_base.dart'; 7 | 8 | class AppHandle extends HandleBase implements intf.AppHandle { 9 | factory AppHandle.from(AppConfiguration configuration) => webNotSupported(); 10 | static AppHandle? get(String id, String? baseUrl) => webNotSupported(); 11 | } 12 | -------------------------------------------------------------------------------- /packages/realm_generator/lib/src/utils.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2021 MongoDB, Inc. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | String anOrA(String text) => 'aeiouy'.contains(text[0]) ? 'an' : 'a'; 5 | 6 | extension IterableEx on Iterable { 7 | T? get singleOrNull => cast().singleWhere((_) => true, orElse: () => null); 8 | } 9 | 10 | extension IterableOverNullableEx on Iterable { 11 | Iterable get whereNotNull => where((i) => i != null).cast(); 12 | } 13 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/nullable_list_elements.expected: -------------------------------------------------------------------------------- 1 | Realm objects in lists must be non-nullable 2 | 3 | in: asset:pkg/test/error_test_data/nullable_list_elements.dart:14:8 4 | ╷ 5 | 8 │ @RealmModel() 6 | 9 │ class _Bad { 7 | │ ━━━━ in realm model for 'Bad' 8 | ... │ 9 | 14 │ late List<_Other?> wrong; 10 | │ ^^^^^^^^^^^^^ which has a nullable realm object element type 11 | ╵ 12 | Ensure element type is non-nullable 13 | 14 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: true 2 | contact_links: 3 | - name: General Questions and Inquiries 4 | url: https://www.mongodb.com/community/forums/tags/c/atlas-app-services-realm/realm/58/flutter 5 | about: Please ask general design/architecture questions in the community forums. 6 | - name: MongoDB Atlas Device Sync Production Issues 7 | url: https://support.mongodb.com/ 8 | about: Please report urgent production issues to the support portal directly. 9 | -------------------------------------------------------------------------------- /packages/ejson_annotation/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: ejson_annotation 2 | description: >- 3 | Annotation for EJSON serialization. 4 | 5 | BSON is a binary format used to store JSON-like documents efficiently. 6 | EJSON extends JSON defining how all BSON types should be represented in JSON. 7 | 8 | version: 0.4.0 9 | repository: https://github.com/realm/realm-dart/ejson/packages/ejson_annotation 10 | 11 | environment: 12 | sdk: ^3.6.0 13 | 14 | dev_dependencies: 15 | lints: ^5.1.1 16 | -------------------------------------------------------------------------------- /packages/realm_generator/build.yaml: -------------------------------------------------------------------------------- 1 | targets: 2 | $default: 3 | builders: 4 | realm_generator: 5 | enabled: true 6 | generate_for: 7 | include: 8 | - test/good_test_data/**.dart 9 | 10 | builders: 11 | realm_generator: 12 | import: "package:realm_generator/realm_generator.dart" 13 | builder_factories: ["generateRealmObjects"] 14 | build_extensions: { ".dart": [".realm.dart"] } 15 | auto_apply: dependents 16 | build_to: source -------------------------------------------------------------------------------- /packages/realm/.pubignore: -------------------------------------------------------------------------------- 1 | # ignore realm files 2 | *.realm* 3 | 4 | # Ignore symlinks 5 | # Unfortuantely this don't work. We need to remove the symlinks before publishing 6 | /android/src/main/cpp/lib/ 7 | /ios/realm_flutter_ios.xcframework 8 | # No symlink for macos 9 | # /macos/librealm_dart.dylib 10 | /windows/binary 11 | /linux/binary 12 | 13 | # Ignore realm-cre pem files 14 | /ios/src/realm-core/**/*.pem 15 | 16 | # Ignore the special tests folder for the flutter driver tests 17 | tests/ 18 | -------------------------------------------------------------------------------- /packages/realm/tests/linux/flutter/generated_plugin_registrant.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #include "generated_plugin_registrant.h" 8 | 9 | #include 10 | 11 | void fl_register_plugins(FlPluginRegistry* registry) { 12 | g_autoptr(FlPluginRegistrar) realm_registrar = 13 | fl_plugin_registry_get_registrar_for_plugin(registry, "RealmPlugin"); 14 | realm_plugin_register_with_registrar(realm_registrar); 15 | } 16 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/backlink_incompatible_type.expected: -------------------------------------------------------------------------------- 1 | Incompatible backlink type 2 | 3 | in: asset:pkg/test/error_test_data/backlink_incompatible_type.dart:11:8 4 | ╷ 5 | 8 │ @RealmModel() 6 | 9 │ class _Target { 7 | │ ━━━━━━━ in realm model for 'Target' 8 | 10 │ @Backlink(#target) 9 | 11 │ late Iterable<_IncompatibleSource> backlinks; 10 | │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ _IncompatibleSource.target is not a '_Target?' or 'List<_Target>' 11 | ╵ -------------------------------------------------------------------------------- /packages/realm/tests/ios/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import Flutter 3 | 4 | @UIApplicationMain 5 | @objc class AppDelegate: FlutterAppDelegate { 6 | override func application( 7 | _ application: UIApplication, 8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? 9 | ) -> Bool { 10 | GeneratedPluginRegistrant.register(with: self) 11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /packages/realm/tests/linux/my_application.h: -------------------------------------------------------------------------------- 1 | #ifndef FLUTTER_MY_APPLICATION_H_ 2 | #define FLUTTER_MY_APPLICATION_H_ 3 | 4 | #include 5 | 6 | G_DECLARE_FINAL_TYPE(MyApplication, my_application, MY, APPLICATION, 7 | GtkApplication) 8 | 9 | /** 10 | * my_application_new: 11 | * 12 | * Creates a new Flutter-based application. 13 | * 14 | * Returns: a new #MyApplication. 15 | */ 16 | MyApplication* my_application_new(); 17 | 18 | #endif // FLUTTER_MY_APPLICATION_H_ 19 | -------------------------------------------------------------------------------- /packages/realm/tests/macos/Runner/MainFlutterWindow.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | class MainFlutterWindow: NSWindow { 5 | override func awakeFromNib() { 6 | let flutterViewController = FlutterViewController() 7 | let windowFrame = self.frame 8 | self.contentViewController = flutterViewController 9 | self.setFrame(windowFrame, display: true) 10 | 11 | RegisterGeneratedPlugins(registry: flutterViewController) 12 | 13 | super.awakeFromNib() 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/asymmetric_wrong_pk.expected: -------------------------------------------------------------------------------- 1 | Asymmetric objects must have a primary key named _id 2 | 3 | in: asset:pkg/test/error_test_data/asymmetric_wrong_pk.dart:6:17 4 | ╷ 5 | 3 │ @RealmModel(ObjectType.asymmetricObject) 6 | 4 │ class _BadAsymmetric { 7 | │ ━━━━━━━━━━━━━━ in realm model for 'BadAsymmetric' 8 | 5 │ @PrimaryKey() 9 | 6 │ late ObjectId wrongName; 10 | │ ^^^^^^^^^ ! 11 | ╵ 12 | Add @MapTo("_id") to the @PrimaryKey field 13 | 14 | -------------------------------------------------------------------------------- /packages/realm_generator/test/good_test_data/asymmetric_object.dart: -------------------------------------------------------------------------------- 1 | import 'package:realm_common/realm_common.dart'; 2 | 3 | part 'asymmetric_object.realm.dart'; 4 | 5 | @RealmModel() 6 | class _Asymmetric { 7 | @PrimaryKey() 8 | @MapTo('_id') 9 | late ObjectId id; 10 | 11 | late List<_Embedded> children; 12 | late _Embedded? father; 13 | late _Embedded? mother; 14 | } 15 | 16 | @RealmModel(ObjectType.embeddedObject) 17 | class _Embedded { 18 | late String name; 19 | late int age; 20 | } 21 | -------------------------------------------------------------------------------- /packages/realm/tests/macos/Runner/DebugProfile.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.cs.allow-jit 8 | 9 | com.apple.security.network.server 10 | 11 | com.apple.security.network.client 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /packages/realm_dart/lib/src/handles/scheduler_handle.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2024 MongoDB, Inc. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import 'dart:isolate'; 5 | 6 | import 'handle_base.dart'; 7 | 8 | import 'native/scheduler_handle.dart' if (dart.library.js_interop) 'web/scheduler_handle.dart' as impl; 9 | 10 | abstract interface class SchedulerHandle extends HandleBase { 11 | factory SchedulerHandle(int isolateId, SendPort port) = impl.SchedulerHandle; 12 | 13 | void invoke(int workQueue); 14 | } 15 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/repeated_field_annotations.expected: -------------------------------------------------------------------------------- 1 | Repeated annotation 2 | 3 | in: asset:pkg/test/error_test_data/repeated_field_annotations.dart:9:3 4 | ╷ 5 | 5 │ @RealmModel() 6 | 6 │ class _Bad { 7 | │ ━━━━ in realm model for 'Bad' 8 | 7 │ @PrimaryKey() 9 | │ ━━━━━━━━━━━━━ 10 | ... │ 11 | 9 │ @PrimaryKey() 12 | │ ^^^^^^^^^^^^^ duplicated annotation 13 | 10 │ late int id; 14 | ╵ 15 | Remove all duplicated @PrimaryKey() annotations. 16 | 17 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/unsupported_non_realm_type_set.expected: -------------------------------------------------------------------------------- 1 | Not a realm type 2 | 3 | in: asset:pkg/test/error_test_data/unsupported_non_realm_type_set.dart:10:8 4 | ╷ 5 | 5 │ @RealmModel() 6 | 6 │ class _Bad { 7 | │ ━━━━ in realm model for 'Bad' 8 | ... │ 9 | 10 │ late Set wrong; 10 | │ ^^^^^^^^^^^^^^^^^^^^ Set is not a realm model type 11 | ╵ 12 | Remove the invalid field or add an @Ignored annotation on 'wrong'. 13 | 14 | -------------------------------------------------------------------------------- /dartdoc_options.yaml: -------------------------------------------------------------------------------- 1 | dartdoc: 2 | categories: 3 | "Configuration": 4 | "Annotations": 5 | "Realm": 6 | "Application": 7 | "Sync": 8 | categoryOrder: ["Realm", "Configuration", "Annotations", "Application", "Sync"] 9 | examplePathPrefix: 'example' 10 | # nodoc: ['generator/flutter/ffigen/scripts/src/test/*.g.dart'] 11 | showUndocumentedCategories: true 12 | # ignore: 13 | # - ambiguous-doc-reference 14 | # errors: 15 | # - unresolved-doc-reference 16 | # warnings: 17 | # - tool-error -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/unsupported_realm_set_of_nullable_realmobject.expected: -------------------------------------------------------------------------------- 1 | Realm objects in sets must be non-nullable 2 | 3 | in: asset:pkg/test/error_test_data/unsupported_realm_set_of_nullable_realmobject.dart:10:8 4 | ╷ 5 | 5 │ @RealmModel() 6 | 6 │ class _Bad { 7 | │ ━━━━ in realm model for 'Bad' 8 | ... │ 9 | 10 │ late Set<_Bad?> wrong1; 10 | │ ^^^^^^^^^^ which has a nullable realm object element type 11 | ╵ 12 | Ensure element type is non-nullable 13 | 14 | -------------------------------------------------------------------------------- /.github/workflows/lock-threads.yml: -------------------------------------------------------------------------------- 1 | name: 'Lock Threads' 2 | 3 | on: 4 | schedule: 5 | - cron: '0 * * * *' 6 | workflow_dispatch: 7 | 8 | permissions: 9 | issues: write 10 | pull-requests: write 11 | discussions: write 12 | 13 | concurrency: 14 | group: lock-threads 15 | 16 | jobs: 17 | action: 18 | runs-on: ubuntu-latest 19 | steps: 20 | - uses: dessant/lock-threads@v5 21 | with: 22 | issue-inactive-days: 30 23 | pr-inactive-days: 30 24 | log-output: true 25 | -------------------------------------------------------------------------------- /packages/realm_dart/lib/src/handles/subscription_handle.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2024 MongoDB, Inc. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import 'package:realm_common/realm_common.dart'; 5 | 6 | import 'handle_base.dart'; 7 | 8 | abstract interface class SubscriptionHandle extends HandleBase { 9 | ObjectId get id; 10 | String? get name; 11 | String get objectClassName; 12 | String get queryString; 13 | DateTime get createdAt; 14 | DateTime get updatedAt; 15 | bool equalTo(SubscriptionHandle other); 16 | } 17 | -------------------------------------------------------------------------------- /packages/ejson_generator/build.yaml: -------------------------------------------------------------------------------- 1 | targets: 2 | $default: 3 | builders: 4 | ejson_generator: 5 | enabled: true 6 | generate_for: 7 | include: 8 | - test/** 9 | 10 | builders: 11 | ejson_generator: 12 | import: "package:ejson_generator/ejson_generator.dart" 13 | builder_factories: ["getEJsonGenerator"] 14 | build_extensions: { ".dart": ["ejson.g.part"] } 15 | auto_apply: dependents 16 | build_to: cache 17 | applies_builders: ["source_gen|combining_builder"] 18 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/fts_index_wrong_type.expected: -------------------------------------------------------------------------------- 1 | Cannot add full-text index on a non-string property 2 | 3 | in: asset:pkg/test/error_test_data/fts_index_wrong_type.dart:6:8 4 | ╷ 5 | 3 │ @RealmModel() 6 | 4 │ class _Foo { 7 | │ ━━━━ in realm model for 'Foo' 8 | 5 │ @Indexed(RealmIndexType.fullText) 9 | 6 │ late bool boolValue; 10 | │ ^^^^ Cannot use RealmIndexType.fullText for property of type bool 11 | ╵ 12 | Change the index type to general or change the property type to string 13 | 14 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/missing_underscore.expected: -------------------------------------------------------------------------------- 1 | Not a realm type 2 | 3 | in: asset:pkg/test/error_test_data/missing_underscore.dart:7:8 4 | ╷ 5 | 5 │ @RealmModel() 6 | 6 │ class _Bad { 7 | │ ━━━━ in realm model for 'Bad' 8 | 7 │ late Other other; 9 | │ ^^^^^ Other is not a realm model type 10 | ... │ 11 | 13 │ class Other extends _Other {} // mock class for testing 12 | │ ━━━━━ 13 | ╵ 14 | Add a @RealmModel annotation on 'Other', or an @Ignored annotation on 'other'. -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/not_a_realm_type.expected: -------------------------------------------------------------------------------- 1 | Not a realm type 2 | 3 | in: asset:pkg/test/error_test_data/not_a_realm_type.dart:9:8 4 | ╷ 5 | 5 │ class NonRealm {} 6 | │ ━━━━━━━━ 7 | ... │ 8 | 7 │ @RealmModel() 9 | 8 │ class _Bad { 10 | │ ━━━━ in realm model for 'Bad' 11 | 9 │ late NonRealm notARealmType; 12 | │ ^^^^^^^^ NonRealm is not a realm model type 13 | ╵ 14 | Add a @RealmModel annotation on 'NonRealm', or an @Ignored annotation on 'notARealmType'. 15 | 16 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/realm_object_reference_default_values.expected: -------------------------------------------------------------------------------- 1 | Realm object references should not have default values 2 | 3 | in: asset:pkg/test/error_test_data/realm_object_reference_default_values.dart:8:26 4 | ╷ 5 | 5 │ @RealmModel() 6 | 6 │ class _Person { 7 | │ ━━━━━━━ in realm model for 'Person' 8 | ... │ 9 | 8 │ late _Person? parent = Person(); 10 | │ ^^^^^^^^ Remove the default value 11 | ╵ 12 | Remove the default value for field "parent" 13 | 14 | -------------------------------------------------------------------------------- /packages/realm/tests/windows/runner/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by Runner.rc 4 | // 5 | #define IDI_APP_ICON 101 6 | 7 | // Next default values for new objects 8 | // 9 | #ifdef APSTUDIO_INVOKED 10 | #ifndef APSTUDIO_READONLY_SYMBOLS 11 | #define _APS_NEXT_RESOURCE_VALUE 102 12 | #define _APS_NEXT_COMMAND_VALUE 40001 13 | #define _APS_NEXT_CONTROL_VALUE 1001 14 | #define _APS_NEXT_SYMED_VALUE 101 15 | #endif 16 | #endif 17 | -------------------------------------------------------------------------------- /packages/realm/tests/android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/set_non_empty_initializer.expected: -------------------------------------------------------------------------------- 1 | Non-empty default values for sets are not supported. 2 | 3 | in: asset:pkg/test/error_test_data/set_non_empty_initializer.dart:8:30 4 | ╷ 5 | 5 │ @RealmModel() 6 | 6 │ class _Bad { 7 | │ ━━━━ in realm model for 'Bad' 8 | ... │ 9 | 8 │ final setWithInitializer = {0}; 10 | │ ^^^ Remove the default value. 11 | ╵ 12 | Remove the default value for field setWithInitializer or change it to be an empty collection. 13 | 14 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/list_non_empty_initializer.expected: -------------------------------------------------------------------------------- 1 | Non-empty default values for lists are not supported. 2 | 3 | in: asset:pkg/test/error_test_data/list_non_empty_initializer.dart:8:31 4 | ╷ 5 | 5 │ @RealmModel() 6 | 6 │ class _Bad { 7 | │ ━━━━ in realm model for 'Bad' 8 | ... │ 9 | 8 │ final listWithInitializer = [0]; 10 | │ ^^^ Remove the default value. 11 | ╵ 12 | Remove the default value for field listWithInitializer or change it to be an empty collection. 13 | 14 | -------------------------------------------------------------------------------- /packages/realm/tests/android/app/src/main/res/drawable-v21/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/date_primary_key.expected: -------------------------------------------------------------------------------- 1 | Realm only supports the @PrimaryKey annotation on fields of type 2 | int, String, ObjectId, Uuid 3 | as well as their nullable versions 4 | 5 | in: asset:pkg/test/error_test_data/date_primary_key.dart:8:8 6 | ╷ 7 | 5 │ @RealmModel() 8 | 6 │ class _Bad { 9 | │ ━━━━ in realm model for 'Bad' 10 | 7 │ @PrimaryKey() 11 | 8 │ late DateTime id; 12 | │ ^^^^^^^^ DateTime is not a valid type here 13 | ╵ 14 | Change the type of 'id' or remove the @PrimaryKey annotation 15 | 16 | -------------------------------------------------------------------------------- /packages/ejson_analyzer/lib/src/ejson_analyzer_base.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2024 MongoDB, Inc. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import 'package:analyzer/dart/element/element.dart'; 5 | import 'package:ejson_annotation/ejson_annotation.dart'; 6 | import 'package:source_gen/source_gen.dart'; 7 | 8 | TypeChecker get typeChecker => TypeChecker.fromRuntime(EJson); 9 | 10 | EJson getEJsonAnnotation(Element element) => typeChecker.firstAnnotationOfExact(element) as EJson; 11 | bool isEJsonAnnotated(Element element) => typeChecker.hasAnnotationOfExact(element); 12 | -------------------------------------------------------------------------------- /packages/realm/build.yaml: -------------------------------------------------------------------------------- 1 | targets: 2 | $default: 3 | sources: 4 | exclude: 5 | - '**/ephemeral/**' 6 | 7 | builders: 8 | realm_generator: 9 | generate_for: 10 | include: 11 | - test/**.dart 12 | - example/**.dart 13 | 14 | builders: 15 | realm_generator: 16 | import: "package:realm_generator/realm_generator.dart" 17 | builder_factories: ["generateRealmObjects"] 18 | build_extensions: { ".dart": [".realm.dart"] } 19 | auto_apply: dependents 20 | build_to: source 21 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/dict_non_empty_initializer.expected: -------------------------------------------------------------------------------- 1 | Non-empty default values for maps are not supported. 2 | 3 | in: asset:pkg/test/error_test_data/dict_non_empty_initializer.dart:8:31 4 | ╷ 5 | 5 │ @RealmModel() 6 | 6 │ class _Bad { 7 | │ ━━━━ in realm model for 'Bad' 8 | ... │ 9 | 8 │ final dictWithInitializer = {"a": 5}; 10 | │ ^^^^^^^^ Remove the default value. 11 | ╵ 12 | Remove the default value for field dictWithInitializer or change it to be an empty collection. 13 | 14 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/embedded_object_primary_key.expected: -------------------------------------------------------------------------------- 1 | Primary key not allowed on embedded objects 2 | 3 | in: asset:pkg/test/error_test_data/embedded_object_primary_key.dart:8:12 4 | ╷ 5 | 5 │ @RealmModel(ObjectType.embeddedObject) 6 | 6 │ class _Bad { 7 | │ ━━━━ 8 | 7 │ @PrimaryKey() 9 | 8 │ late int id; 10 | │ ^^ Bad is marked as embedded but has primary key defined 11 | ╵ 12 | Remove the @PrimaryKey annotation from the field or set the model type to a value different from ObjectType.embeddedObject. 13 | 14 | -------------------------------------------------------------------------------- /packages/realm/tests/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchImage.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchImage@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "LaunchImage@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/list_of_list_not_supported.expected: -------------------------------------------------------------------------------- 1 | Not a realm type 2 | 3 | in: asset:pkg/test/error_test_data/list_of_list_not_supported.dart:8:21 4 | ╷ 5 | 5 │ @RealmModel() 6 | 6 │ class _Bad { 7 | │ ━━━━ in realm model for 'Bad' 8 | ... │ 9 | 8 │ var listOfLists = [ 10 | │ ┌─────────────────────^ 11 | 9 │ │ [0], 12 | 10 │ │ [1] 13 | 11 │ │ ]; 14 | │ └───^ List> is not a realm model type 15 | ╵ 16 | Remove the invalid field or add an @Ignored annotation on 'listOfLists'. 17 | 18 | -------------------------------------------------------------------------------- /packages/ejson_lint/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: ejson_lint 2 | description: >- 3 | Lints for EJSON. 4 | 5 | BSON is a binary format used to store JSON-like documents efficiently. 6 | EJSON extends JSON defining how all BSON types should be represented in JSON. 7 | 8 | version: 0.4.0 9 | repository: https://github.com/realm/realm-dart/ejson/packages/ejson_lint 10 | 11 | environment: 12 | sdk: ^3.6.0 13 | 14 | dependencies: 15 | analyzer: ^7.3.0 16 | custom_lint_builder: ^0.7.1 17 | ejson_analyzer: ^0.4.0 18 | 19 | dev_dependencies: 20 | lints: ^5.1.1 21 | test: ^1.25.9 22 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/unsupported_realm_set_with_default_values.expected: -------------------------------------------------------------------------------- 1 | Non-empty default values for sets are not supported. 2 | 3 | in: asset:pkg/test/error_test_data/unsupported_realm_set_with_default_values.dart:10:27 4 | ╷ 5 | 5 │ @RealmModel() 6 | 6 │ class _Bad { 7 | │ ━━━━ in realm model for 'Bad' 8 | ... │ 9 | 10 │ late Set wrong1 = {true, false}; 10 | │ ^^^^^^^^^^^^^ Remove the default value. 11 | ╵ 12 | Remove the default value for field wrong1 or change it to be an empty collection. 13 | 14 | -------------------------------------------------------------------------------- /packages/ejson/example/main.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2024 MongoDB, Inc. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import 'dart:convert'; 5 | 6 | import 'package:ejson/ejson.dart'; 7 | import 'package:test/test.dart'; 8 | 9 | void main() { 10 | test('round-trip', () { 11 | final value = { 12 | 'abe': [1, 4], 13 | 'kat': [], 14 | }; 15 | final encoded = toEJson(value); 16 | final json = jsonEncode(encoded); 17 | print(json); 18 | final decoded = fromEJson>>(jsonDecode(json)); 19 | expect(value, decoded); 20 | }); 21 | } 22 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/unsupported_realm_set_of_nullable_realmvalue.expected: -------------------------------------------------------------------------------- 1 | Set is not supported 2 | 3 | in: asset:pkg/test/error_test_data/unsupported_realm_set_of_nullable_realmvalue.dart:10:8 4 | ╷ 5 | 5 │ @RealmModel() 6 | 6 │ class _Bad { 7 | │ ━━━━ in realm model for 'Bad' 8 | ... │ 9 | 10 │ late Set wrong1; 10 | │ ^^^^^^^^^^^^^^^^ Nullable RealmValues are not supported 11 | ╵ 12 | Ensure the RealmValue type argument is non-nullable. RealmValue can hold null, but must not be nullable itself. 13 | 14 | -------------------------------------------------------------------------------- /packages/realm_dart/scripts/build-android.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | 3 | @REM ANDROID_NDK should be set 4 | @REM Output is in PROJECT_ROOT\binary directory 5 | @REM example usage: ....\realm-dart>scripts\build-android.bat all 6 | 7 | @REM Start in the root directory of the project. 8 | pushd "%~dp0.." 9 | echo %CD% 10 | 11 | @REM only building for x86 if no arguments 12 | set ABIS=x86 x86_64 armeabi-v7a arm64-v8a 13 | if [%1]==[] set ABIS=x86 14 | 15 | (for %%a in (%ABIS%) do ( 16 | cmake --preset android-%%a 17 | cmake --build --preset android-%%a --config MinSizeRel --target strip 18 | )) 19 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/bool_not_allowed_as_primary_key.expected: -------------------------------------------------------------------------------- 1 | Realm only supports the @PrimaryKey annotation on fields of type 2 | int, String, ObjectId, Uuid 3 | as well as their nullable versions 4 | 5 | in: asset:pkg/test/error_test_data/bool_not_allowed_as_primary_key.dart:9:8 6 | ╷ 7 | 5 │ @RealmModel() 8 | 6 │ @MapTo('Bad') 9 | 7 │ class _Foo { 10 | │ ━━━━ in realm model for 'Foo' 11 | 8 │ @PrimaryKey() 12 | 9 │ late bool bad; 13 | │ ^^^^ bool is not a valid type here 14 | ╵ 15 | Change the type of 'bad' or remove the @PrimaryKey annotation 16 | 17 | -------------------------------------------------------------------------------- /packages/ejson_analyzer/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: ejson_analyzer 2 | description: >- 3 | Common analysis code for EJSON packages. 4 | 5 | BSON is a binary format used to store JSON-like documents efficiently. 6 | EJSON extends JSON defining how all BSON types should be represented in JSON. 7 | 8 | version: 0.4.0 9 | repository: https://github.com/realm/realm-dart/ejson/packages/ejson_analyzer 10 | 11 | environment: 12 | sdk: ^3.6.0 13 | 14 | dependencies: 15 | analyzer: ^7.3.0 16 | ejson_annotation: ^0.4.0 17 | source_gen: ^2.0.0 18 | 19 | dev_dependencies: 20 | lints: ^5.1.1 21 | test: ^1.25.9 22 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/not_an_indexable_type.expected: -------------------------------------------------------------------------------- 1 | Realm only supports the @Indexed annotation on fields of type 2 | int, bool, String, RealmValue, DateTime, ObjectId, Uuid 3 | as well as their nullable versions 4 | 5 | in: asset:pkg/test/error_test_data/not_an_indexable_type.dart:8:8 6 | ╷ 7 | 5 │ @RealmModel() 8 | 6 │ class _Bad { 9 | │ ━━━━ in realm model for 'Bad' 10 | 7 │ @Indexed() 11 | 8 │ late double notAnIndexableType; 12 | │ ^^^^^^ double is not a valid type here 13 | ╵ 14 | Change the type of 'notAnIndexableType' or remove the @Indexed annotation 15 | 16 | -------------------------------------------------------------------------------- /packages/realm/tests/README.md: -------------------------------------------------------------------------------- 1 | # tests 2 | 3 | A new Flutter project. 4 | 5 | ## Getting Started 6 | 7 | This project is a starting point for a Flutter application. 8 | 9 | A few resources to get you started if this is your first Flutter project: 10 | 11 | - [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab) 12 | - [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook) 13 | 14 | For help getting started with Flutter, view our 15 | [online documentation](https://flutter.dev/docs), which offers tutorials, 16 | samples, guidance on mobile development, and a full API reference. 17 | -------------------------------------------------------------------------------- /packages/realm_generator/test/measure_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:realm_generator/src/measure.dart'; 2 | import 'package:test/test.dart'; 3 | 4 | void main() { 5 | test('human readable durations', () { 6 | expect(humanReadable(const Duration(microseconds: 1)), '1μs'); 7 | expect(humanReadable(const Duration(milliseconds: 1)), '1ms'); 8 | expect(humanReadable(const Duration(seconds: 1)), '1.0s'); 9 | expect(humanReadable(const Duration(minutes: 1)), '1m 0s'); 10 | expect(humanReadable(const Duration(hours: 1)), '1h 0m'); 11 | expect(humanReadable(const Duration(days: 1)), '24h 0m'); 12 | }); 13 | } 14 | -------------------------------------------------------------------------------- /packages/realm_common/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: realm_common 2 | description: >- 3 | Hosts the common code shared between realm, realm_dart and realm_generator packages. 4 | This package is part of the official Realm Flutter and Realm Dart SDKs. 5 | 6 | version: 3.5.0 7 | 8 | homepage: https://www.realm.io 9 | repository: https://github.com/realm/realm-dart 10 | issue_tracker: https://github.com/realm/realm-dart/issues 11 | 12 | environment: 13 | sdk: ^3.6.0 14 | 15 | dependencies: 16 | collection: ^1.18.0 17 | objectid: ^4.0.0 18 | sane_uuid: ^1.0.0 19 | 20 | dev_dependencies: 21 | lints: ^5.1.1 22 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/realm_value_not_allowed_as_primary_key.expected: -------------------------------------------------------------------------------- 1 | Realm only supports the @PrimaryKey annotation on fields of type 2 | int, String, ObjectId, Uuid 3 | as well as their nullable versions 4 | 5 | in: asset:pkg/test/error_test_data/realm_value_not_allowed_as_primary_key.dart:7:8 6 | ╷ 7 | 3 │ @RealmModel() 8 | 4 │ @MapTo('Bad') 9 | 5 │ class _Foo { 10 | │ ━━━━ in realm model for 'Foo' 11 | 6 │ @PrimaryKey() 12 | 7 │ late RealmValue bad; 13 | │ ^^^^^^^^^^ RealmValue is not a valid type here 14 | ╵ 15 | Change the type of 'bad' or remove the @PrimaryKey annotation 16 | 17 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/long_mapped_to_name.expected: -------------------------------------------------------------------------------- 1 | Invalid model name 2 | 3 | in: asset:pkg/test/error_test_data/long_mapped_to_name.dart:7:7 4 | ╷ 5 | 5 │ @RealmModel() 6 | 6 │ @MapTo('ThisIsAVeryLongClassNameSoLongInFactThatItRunsOverThe57CharacterLimit') 7 | 7 │ class _Foo { 8 | │ ^^^^ ThisIsAVeryLongClassNameSoLongInFactThatItRunsOverThe57CharacterLimit is too long (> 57 characters) 9 | ╵ 10 | Foo which is stored as ThisIsAVeryLongClassNameSoLongInFactThatItRunsOverThe57CharacterLimit is too long (69 characters when max is 57). Either rename it to something shorter or use the @MapTo annotation. 11 | 12 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/long_class_name.expected: -------------------------------------------------------------------------------- 1 | Invalid model name 2 | 3 | in: asset:pkg/test/error_test_data/long_class_name.dart:6:7 4 | ╷ 5 | 5 │ @RealmModel() 6 | 6 │ class _ThisIsAVeryLongClassNameSoLongInFactThatItRunsOverThe57CharacterLimit { 7 | │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ThisIsAVeryLongClassNameSoLongInFactThatItRunsOverThe57CharacterLimit is too long (> 57 characters) 8 | ╵ 9 | ThisIsAVeryLongClassNameSoLongInFactThatItRunsOverThe57CharacterLimit is too long (69 characters when max is 57). Either rename it to something shorter or use the @MapTo annotation. 10 | 11 | -------------------------------------------------------------------------------- /packages/ejson_lint/lib/src/ejson_lint_base.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2024 MongoDB, Inc. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import 'package:custom_lint_builder/custom_lint_builder.dart'; 5 | 6 | import 'lints/mismatched_getter_type.dart'; 7 | import 'lints/missing_getter.dart'; 8 | import 'lints/too_many_annotated_constructors.dart'; 9 | 10 | PluginBase createPlugin() => _EJsonLinter(); 11 | 12 | class _EJsonLinter extends PluginBase { 13 | @override 14 | List getLintRules(CustomLintConfigs configs) => [ 15 | TooManyAnnotatedConstructors(), 16 | MissingGetter(), 17 | MismatchedGetterType(), 18 | ]; 19 | } 20 | -------------------------------------------------------------------------------- /packages/ejson/lib/src/configuration.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2023 MongoDB, Inc. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import 'package:ejson_annotation/ejson_annotation.dart'; 5 | import 'package:type_plus/type_plus.dart'; 6 | 7 | import 'decoding.dart'; 8 | import 'encoding.dart'; 9 | 10 | /// Register custom EJSON [encoder] and [decoder] for a type [T]. 11 | /// The last registered codec pair for a given type [T] will be used. 12 | void register(EJsonEncoder encoder, EJsonDecoder decoder, {Iterable? superTypes}) { 13 | TypePlus.add(superTypes: superTypes); 14 | customEncoders[T] = encoder; 15 | customDecoders[T] = decoder; 16 | } 17 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test_data/double_primary_key.expected: -------------------------------------------------------------------------------- 1 | Duplicate primary keys 2 | 3 | in: asset:pkg/test/error_test_data/double_primary_key.dart:11:15 4 | ╷ 5 | 5 │ @RealmModel() 6 | 6 │ class _Bad { 7 | │ ━━━━ in realm model for 'Bad' 8 | 7 │ @PrimaryKey() 9 | 8 │ late int first; 10 | │ ━━━━━ 11 | ... │ 12 | 10 │ @PrimaryKey() 13 | 11 │ late String second; 14 | │ ^^^^^^ second primary key 15 | ... │ 16 | 15 │ @PrimaryKey() 17 | 16 │ late String third; 18 | │ ━━━━━ 19 | ╵ 20 | Avoid duplicated @PrimaryKey() on fields 'first', 'second', 'third' 21 | 22 | -------------------------------------------------------------------------------- /packages/realm_generator/test/good_test_data/list_initialization.dart: -------------------------------------------------------------------------------- 1 | import 'package:realm_common/realm_common.dart'; 2 | 3 | part 'list_initialization.realm.dart'; 4 | 5 | @RealmModel() 6 | class _Person { 7 | late List<_Person> children; 8 | 9 | final List initList = []; 10 | final initListWithType = []; 11 | final List initListConst = const []; 12 | 13 | final Set initSet = {}; 14 | final initSetWithType = {}; 15 | final Set initSetConst = const {}; 16 | 17 | final Map initMap = {}; 18 | final initMapWithType = {}; 19 | final Map initMapConst = const {}; 20 | } 21 | -------------------------------------------------------------------------------- /packages/realm_generator/test/good_test_data/embedded_annotations.dart: -------------------------------------------------------------------------------- 1 | import 'package:realm_common/realm_common.dart'; 2 | 3 | part 'embedded_annotations.realm.dart'; 4 | 5 | @RealmModel() 6 | class _Parent { 7 | @MapTo('single child') 8 | late _Child1? child; 9 | 10 | @MapTo('CHILDREN') 11 | late List<_Child1> children; 12 | } 13 | 14 | @RealmModel(ObjectType.embeddedObject) 15 | @MapTo('MySuperChild') 16 | class _Child1 { 17 | @MapTo('_value') 18 | late String value; 19 | 20 | @MapTo('_parent') 21 | late _Parent? linkToParent; 22 | 23 | @Indexed() 24 | late String indexedString; 25 | 26 | @Ignored() 27 | late String ignoredString; 28 | } 29 | -------------------------------------------------------------------------------- /packages/realm/tests/macos/Runner/Configs/Warnings.xcconfig: -------------------------------------------------------------------------------- 1 | WARNING_CFLAGS = -Wall -Wconditional-uninitialized -Wnullable-to-nonnull-conversion -Wmissing-method-return-type -Woverlength-strings 2 | GCC_WARN_UNDECLARED_SELECTOR = YES 3 | CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES 4 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE 5 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES 6 | CLANG_WARN_PRAGMA_PACK = YES 7 | CLANG_WARN_STRICT_PROTOTYPES = YES 8 | CLANG_WARN_COMMA = YES 9 | GCC_WARN_STRICT_SELECTOR_MATCH = YES 10 | CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES 11 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES 12 | GCC_WARN_SHADOW = YES 13 | CLANG_WARN_UNREACHABLE_CODE = YES 14 | -------------------------------------------------------------------------------- /packages/realm_dart/lib/src/handles/mutable_subscription_set_handle.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2024 MongoDB, Inc. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import 'results_handle.dart'; 5 | import 'subscription_handle.dart'; 6 | import 'subscription_set_handle.dart'; 7 | 8 | abstract interface class MutableSubscriptionSetHandle extends SubscriptionSetHandle { 9 | SubscriptionSetHandle commit(); 10 | 11 | SubscriptionHandle insertOrAssignSubscription(ResultsHandle results, String? name, bool update); 12 | 13 | bool erase(SubscriptionHandle subscription); 14 | bool eraseByName(String name); 15 | bool eraseByResults(ResultsHandle results); 16 | 17 | void clear(); 18 | } 19 | -------------------------------------------------------------------------------- /.github/workflows/no-response.yml: -------------------------------------------------------------------------------- 1 | # NOTE: This is a common file that is overwritten by realm/ci-actions sync service 2 | # and should only be modified in that repository. 3 | 4 | name: No Response 5 | 6 | # Both `issue_comment` and `scheduled` event types are required for this Action 7 | # to work properly. 8 | on: 9 | issue_comment: 10 | types: [created] 11 | schedule: 12 | # Schedule at 00:00 every day 13 | - cron: '0 0 * * *' 14 | 15 | jobs: 16 | noResponse: 17 | runs-on: ubuntu-latest 18 | steps: 19 | - uses: lee-dohm/no-response@v0.5.0 20 | with: 21 | token: ${{ github.token }} 22 | responseRequiredLabel: More-information-needed 23 | -------------------------------------------------------------------------------- /packages/realm_dart/lib/src/handles/native/query_handle.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2024 MongoDB, Inc. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import 'dart:ffi'; 5 | 6 | import 'realm_bindings.dart'; 7 | import 'realm_handle.dart'; 8 | import 'realm_library.dart'; 9 | import 'results_handle.dart'; 10 | import 'rooted_handle.dart'; 11 | 12 | class QueryHandle extends RootedHandleBase { 13 | QueryHandle(Pointer pointer, RealmHandle root) : super(root, pointer, 256); 14 | 15 | ResultsHandle findAll() { 16 | try { 17 | return ResultsHandle(realmLib.realm_query_find_all(pointer), root); 18 | } finally { 19 | release(); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /packages/realm/tests/macos/Runner/Configs/AppInfo.xcconfig: -------------------------------------------------------------------------------- 1 | // Application-level settings for the Runner target. 2 | // 3 | // This may be replaced with something auto-generated from metadata (e.g., pubspec.yaml) in the 4 | // future. If not, the values below would default to using the project name when this becomes a 5 | // 'flutter create' template. 6 | 7 | // The application's name. By default this is also the title of the Flutter window. 8 | PRODUCT_NAME = tests 9 | 10 | // The application's bundle identifier 11 | PRODUCT_BUNDLE_IDENTIFIER = io.realm.tests 12 | 13 | // The copyright displayed in application information 14 | PRODUCT_COPYRIGHT = Copyright © 2024 io.realm. All rights reserved. 15 | -------------------------------------------------------------------------------- /packages/realm/tests/android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = '1.8.10' 3 | repositories { 4 | google() 5 | mavenCentral() 6 | } 7 | 8 | dependencies { 9 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 10 | } 11 | } 12 | 13 | allprojects { 14 | repositories { 15 | google() 16 | mavenCentral() 17 | } 18 | } 19 | 20 | rootProject.buildDir = '../build' 21 | subprojects { 22 | project.buildDir = "${rootProject.buildDir}/${project.name}" 23 | } 24 | subprojects { 25 | project.evaluationDependsOn(':app') 26 | } 27 | 28 | tasks.register("clean", Delete) { 29 | delete rootProject.buildDir 30 | } 31 | -------------------------------------------------------------------------------- /packages/realm_dart/src/dart-dl/dart_version.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file 3 | * for details. All rights reserved. Use of this source code is governed by a 4 | * BSD-style license that can be found in the LICENSE file. 5 | */ 6 | 7 | #ifndef RUNTIME_INCLUDE_DART_VERSION_H_ 8 | #define RUNTIME_INCLUDE_DART_VERSION_H_ 9 | 10 | // On breaking changes the major version is increased. 11 | // On backwards compatible changes the minor version is increased. 12 | // The versioning covers the symbols exposed in dart_api_dl.h 13 | #define DART_API_DL_MAJOR_VERSION 2 14 | #define DART_API_DL_MINOR_VERSION 2 15 | 16 | #endif /* RUNTIME_INCLUDE_DART_VERSION_H_ */ /* NOLINT */ 17 | -------------------------------------------------------------------------------- /packages/realm_dart/src/dart-dl/internal/dart_api_dl_impl.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file 3 | * for details. All rights reserved. Use of this source code is governed by a 4 | * BSD-style license that can be found in the LICENSE file. 5 | */ 6 | 7 | #ifndef RUNTIME_INCLUDE_INTERNAL_DART_API_DL_IMPL_H_ 8 | #define RUNTIME_INCLUDE_INTERNAL_DART_API_DL_IMPL_H_ 9 | 10 | typedef struct { 11 | const char* name; 12 | void (*function)(); 13 | } DartApiEntry; 14 | 15 | typedef struct { 16 | const int major; 17 | const int minor; 18 | const DartApiEntry* const functions; 19 | } DartApi; 20 | 21 | #endif /* RUNTIME_INCLUDE_INTERNAL_DART_API_DL_IMPL_H_ */ /* NOLINT */ 22 | -------------------------------------------------------------------------------- /packages/realm_dart/lib/src/cli/archive/options.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2021 MongoDB, Inc. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import 'package:build_cli_annotations/build_cli_annotations.dart'; 5 | 6 | part 'options.g.dart'; 7 | 8 | @CliOptions() 9 | class Options { 10 | @CliOption(help: "This option is required") 11 | final String? sourceDir; 12 | @CliOption(help: "This option is required") 13 | final String? outputFile; 14 | 15 | Options({this.sourceDir, this.outputFile}); 16 | } 17 | 18 | String get usage => _$parserForOptions.usage; 19 | 20 | ArgParser populateOptionsParser(ArgParser p) => _$populateOptionsParser(p); 21 | 22 | Options parseOptionsResult(ArgResults results) => _$parseOptionsResult(results); 23 | -------------------------------------------------------------------------------- /packages/realm_dart/lib/src/cli/extract/options.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2021 MongoDB, Inc. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import 'package:build_cli_annotations/build_cli_annotations.dart'; 5 | 6 | part 'options.g.dart'; 7 | 8 | @CliOptions() 9 | class Options { 10 | @CliOption(help: "This option is required") 11 | final String? outputDir; 12 | @CliOption(help: "This option is required") 13 | final String? sourceFile; 14 | 15 | Options({this.sourceFile, this.outputDir}); 16 | } 17 | 18 | String get usage => _$parserForOptions.usage; 19 | 20 | ArgParser populateOptionsParser(ArgParser p) => _$populateOptionsParser(p); 21 | 22 | Options parseOptionsResult(ArgResults results) => _$parseOptionsResult(results); 23 | -------------------------------------------------------------------------------- /packages/realm_generator/test/good_test_data/map.dart: -------------------------------------------------------------------------------- 1 | import 'dart:typed_data'; 2 | 3 | import 'package:realm_common/realm_common.dart'; 4 | 5 | part 'map.realm.dart'; 6 | 7 | @RealmModel() 8 | class _LotsOfMaps { 9 | late Map persons; 10 | late Map bools; 11 | late Map dateTimes; 12 | late Map decimals; 13 | late Map doubles; 14 | late Map ints; 15 | late Map objectIds; 16 | late Map any; 17 | late Map strings; 18 | late Map binary; 19 | late Map uuids; 20 | } 21 | 22 | @RealmModel() 23 | class _Person { 24 | late String name; 25 | } 26 | -------------------------------------------------------------------------------- /packages/realm/macos/Classes/RealmPlugin.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | public class RealmPlugin: NSObject, FlutterPlugin { 5 | public static func register(with registrar: FlutterPluginRegistrar) { 6 | let channel = FlutterMethodChannel(name: "realm", binaryMessenger: registrar.messenger) 7 | let instance = RealmPlugin() 8 | registrar.addMethodCallDelegate(instance, channel: channel) 9 | } 10 | 11 | public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) { 12 | switch call.method { 13 | case "getPlatformVersion": 14 | result("macOS " + ProcessInfo.processInfo.operatingSystemVersionString) 15 | default: 16 | result(FlutterMethodNotImplemented) 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /packages/CHANGELOG.ejson.md: -------------------------------------------------------------------------------- 1 | ## 0.4.1 2 | 3 | - Upgrade min Dart SDK to 3.6.0, update all dependencies to latest stable version, and tighten lower bounds. 4 | - Avoid name conflict on `LinkCode`. 5 | 6 | ## 0.4.0 7 | 8 | - `fromEJson` now accepts a `defaultValue` argument that is returned if 9 | `null` is passed as `ejson`. 10 | - `register` takes an optional `superTypes` argument to specify the super 11 | types of `T` if needed. 12 | 13 | ## 0.3.1 14 | 15 | - Update sane_uuid dependency to ^1.0.0 (compensate for breaking change) 16 | 17 | ## 0.3.0 18 | 19 | - Rename `Key` class to `BsonKey` to avoid common conflict with flutter 20 | 21 | ## 0.2.0-pre.1 22 | 23 | - First published version. 24 | 25 | ## 0.1.0 26 | 27 | - Initial version. 28 | -------------------------------------------------------------------------------- /.github/no-response.yml: -------------------------------------------------------------------------------- 1 | # Configuration for probot-no-response - https://github.com/probot/no-response 2 | 3 | # Number of days of inactivity before an Issue is closed for lack of response 4 | daysUntilClose: 14 5 | # Label requiring a response 6 | responseRequiredLabel: More-information-needed 7 | # Comment to post when closing an Issue for lack of response. Set to `false` to disable 8 | closeComment: > 9 | This issue has been automatically closed because there has been no response 10 | to our request for more information from the original author. With only the 11 | information that is currently in the issue, we don't have enough information 12 | to take action. Please reach out if you have or find the answers we need so 13 | that we can investigate further. 14 | -------------------------------------------------------------------------------- /packages/ejson/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: ejson 2 | description: >- 3 | EJSON serialization. 4 | 5 | BSON is a binary format used to store JSON-like documents efficiently. 6 | EJSON extends JSON defining how all BSON types should be represented in JSON. 7 | 8 | topics: 9 | - ejson 10 | - bson 11 | - json 12 | - build-runner 13 | - codegen 14 | 15 | version: 0.4.0 16 | repository: https://github.com/realm/realm-dart/ejson/packages/ejson 17 | 18 | environment: 19 | sdk: ^3.6.0 20 | 21 | dependencies: 22 | collection: ^1.19.0 23 | ejson_annotation: ^0.4.0 24 | objectid: ^4.0.0 25 | sane_uuid: ^1.0.0 26 | type_plus: ^2.0.0 27 | 28 | dev_dependencies: 29 | build_runner: ^2.4.14 30 | ejson_generator: ^0.4.0 31 | lints: ^5.1.1 32 | test: ^1.25.9 33 | -------------------------------------------------------------------------------- /packages/realm_dart/lib/src/handles/web/async_open_task_handle.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2024 MongoDB, Inc. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import 'package:realm_dart/realm.dart'; 5 | 6 | import '../async_open_task_handle.dart' as intf; 7 | import 'handle_base.dart'; 8 | 9 | class AsyncOpenTaskHandle extends HandleBase implements intf.AsyncOpenTaskHandle { 10 | factory AsyncOpenTaskHandle.from(FlexibleSyncConfiguration config) => webNotSupported(); 11 | 12 | @override 13 | noSuchMethod(Invocation invocation) => webNotSupported(); 14 | } 15 | 16 | abstract class AsyncOpenTaskProgressNotificationTokenHandle implements intf.AsyncOpenTaskProgressNotificationTokenHandle { 17 | @override 18 | noSuchMethod(Invocation invocation) => webNotSupported(); 19 | } 20 | -------------------------------------------------------------------------------- /packages/realm/tests/windows/runner/utils.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_UTILS_H_ 2 | #define RUNNER_UTILS_H_ 3 | 4 | #include 5 | #include 6 | 7 | // Creates a console for the process, and redirects stdout and stderr to 8 | // it for both the runner and the Flutter library. 9 | void CreateAndAttachConsole(); 10 | 11 | // Takes a null-terminated wchar_t* encoded in UTF-16 and returns a std::string 12 | // encoded in UTF-8. Returns an empty std::string on failure. 13 | std::string Utf8FromUtf16(const wchar_t* utf16_string); 14 | 15 | // Gets the command line arguments passed in as a std::vector, 16 | // encoded in UTF-8. Returns an empty std::vector on failure. 17 | std::vector GetCommandLineArguments(); 18 | 19 | #endif // RUNNER_UTILS_H_ 20 | -------------------------------------------------------------------------------- /packages/realm_generator/lib/src/type_checkers.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2021 MongoDB, Inc. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import 'package:realm_common/realm_common.dart'; 5 | import 'package:source_gen/source_gen.dart'; 6 | 7 | const ignoredChecker = TypeChecker.fromRuntime(Ignored); 8 | 9 | const indexedChecker = TypeChecker.fromRuntime(Indexed); 10 | 11 | const mapToChecker = TypeChecker.fromRuntime(MapTo); 12 | 13 | const primaryKeyChecker = TypeChecker.fromRuntime(PrimaryKey); 14 | 15 | const backlinkChecker = TypeChecker.fromRuntime(Backlink); 16 | 17 | const realmAnnotationChecker = TypeChecker.any([ 18 | ignoredChecker, 19 | indexedChecker, 20 | mapToChecker, 21 | primaryKeyChecker, 22 | ]); 23 | 24 | const realmModelChecker = TypeChecker.fromRuntime(RealmModel); 25 | -------------------------------------------------------------------------------- /packages/realm_dart/build.yaml: -------------------------------------------------------------------------------- 1 | targets: 2 | $default: 3 | builders: 4 | build_cli: 5 | generate_for: 6 | - lib/src/cli/**/**.dart 7 | json_serializable: 8 | generate_for: 9 | - lib/src/cli/metrics/flutter_info.dart 10 | - lib/src/cli/metrics/metrics.dart 11 | realm_generator: 12 | generate_for: 13 | include: 14 | - test/**.dart 15 | - example/**.dart 16 | 17 | builders: 18 | realm_generator: 19 | import: "package:realm_generator/realm_generator.dart" 20 | builder_factories: ["generateRealmObjects"] 21 | build_extensions: { ".dart": [".realm.dart"] } 22 | auto_apply: dependents 23 | build_to: source 24 | runs_before: ["ejson_generator|ejson_generator"] 25 | -------------------------------------------------------------------------------- /packages/realm/windows/include/realm/realm_plugin.h: -------------------------------------------------------------------------------- 1 | #ifndef FLUTTER_PLUGIN_REALM_PLUGIN_H_ 2 | #define FLUTTER_PLUGIN_REALM_PLUGIN_H_ 3 | 4 | #include 5 | 6 | #ifdef FLUTTER_PLUGIN_IMPL 7 | #define FLUTTER_PLUGIN_EXPORT __declspec(dllexport) 8 | #else 9 | #define FLUTTER_PLUGIN_EXPORT __declspec(dllimport) 10 | #endif 11 | 12 | #if defined(__cplusplus) 13 | extern "C" { 14 | #endif 15 | 16 | FLUTTER_PLUGIN_EXPORT void RealmPluginRegisterWithRegistrar( 17 | FlutterDesktopPluginRegistrarRef registrar); 18 | 19 | FLUTTER_PLUGIN_EXPORT const wchar_t* realm_dart_get_app_directory(); 20 | 21 | FLUTTER_PLUGIN_EXPORT const char* realm_dart_get_bundle_id(); 22 | 23 | #if defined(__cplusplus) 24 | } // extern "C" 25 | #endif 26 | 27 | #endif // FLUTTER_PLUGIN_REALM_PLUGIN_H_ 28 | -------------------------------------------------------------------------------- /packages/realm_generator/lib/realm_generator.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2021 MongoDB, Inc. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | /// Usage 5 | /// 6 | /// * Add a dependency to [realm](https://pub.dev/packages/realm) package or [realm_dart](https://pub.dev/packages/realm_dart) package to your application 7 | /// * Run `dart run build_runner build` or `dart run build_runner build` to generate RealmObjects 8 | 9 | library realm_generator; 10 | 11 | import 'package:build/build.dart'; 12 | import 'package:source_gen/source_gen.dart'; 13 | 14 | import 'src/realm_object_generator.dart'; 15 | 16 | export 'src/error.dart'; 17 | 18 | /// @nodoc 19 | Builder generateRealmObjects([BuilderOptions? options]) { 20 | return PartBuilder( 21 | [RealmObjectGenerator()], 22 | '.realm.dart', 23 | ); 24 | } 25 | -------------------------------------------------------------------------------- /.github/workflows/check-changelog.yml: -------------------------------------------------------------------------------- 1 | # NOTE: This is a common file that is overwritten by realm/ci-actions sync service 2 | # and should only be modified in that repository. 3 | 4 | name: "Check Changelog" 5 | on: 6 | pull_request: 7 | types: [opened, synchronize, reopened, ready_for_review, labeled, unlabeled] 8 | 9 | jobs: 10 | changelog: 11 | runs-on: ubuntu-latest 12 | steps: 13 | - name: Checkout 14 | uses: actions/checkout@v4 15 | with: 16 | submodules: false 17 | - name: Enforce Changelog 18 | uses: dangoslen/changelog-enforcer@c0b9fd225180a405c5f21f7a74b99e2eccc3e951 19 | with: 20 | skipLabels: no-changelog 21 | missingUpdateErrorMessage: Please add an entry in CHANGELOG.md or apply the 'no-changelog' label to skip this check. 22 | -------------------------------------------------------------------------------- /packages/realm/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: realm 2 | description: The official Realm SDK for Flutter. Realm is a mobile database - an alternative to SQLite and key-value stores. 3 | version: 3.5.0 4 | 5 | homepage: https://www.realm.io 6 | repository: https://github.com/realm/realm-dart 7 | issue_tracker: https://github.com/realm/realm-dart/issues 8 | 9 | environment: 10 | sdk: ^3.6.0 11 | flutter: ^3.27.0 12 | 13 | dependencies: 14 | flutter: 15 | sdk: flutter 16 | realm_dart: ^3.5.0 17 | 18 | flutter: 19 | plugin: 20 | platforms: 21 | android: 22 | package: io.realm 23 | pluginClass: RealmPlugin 24 | ios: 25 | pluginClass: RealmPlugin 26 | linux: 27 | pluginClass: RealmPlugin 28 | macos: 29 | pluginClass: RealmPlugin 30 | windows: 31 | pluginClass: RealmPlugin 32 | -------------------------------------------------------------------------------- /packages/realm_dart/lib/src/handles/native/convert.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2024 MongoDB, Inc. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import 'dart:ffi'; 5 | 6 | import 'handle_base.dart'; 7 | 8 | extension PointerEx on Pointer { 9 | Pointer? get nullPtrAsNull => this == nullptr ? null : this; 10 | U? convert(U Function(Pointer) convertor) => nullPtrAsNull.convert(convertor); 11 | } 12 | 13 | extension HandleBaseEx on T { 14 | T? get nullPtrAsNull => pointer == nullptr ? null : this; 15 | U? convert(U Function(T) convertor) => nullPtrAsNull.convert(convertor); 16 | } 17 | 18 | extension NullableObjectEx on T? { 19 | U? convert(U Function(T) convertor) { 20 | final self = this; 21 | if (self == null) return null; 22 | return convertor(self); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /packages/realm_generator/test/good_test.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | import 'package:path/path.dart' as path; 3 | import 'test_util.dart'; 4 | 5 | void main() async { 6 | const directory = 'test/good_test_data'; 7 | 8 | await for (final generatedFile in Directory(directory).list(recursive: true).where((f) => f.path.endsWith('.expected'))) { 9 | final sourceFile = File(generatedFile.path.replaceFirst('.expected', '.dart')); 10 | testCompile('compile $sourceFile', sourceFile, generatedFile); 11 | } 12 | 13 | testCompileMany( 14 | 'Link to mapped class', 15 | [ 16 | 'another_mapto.dart', 17 | 'mapto.dart', 18 | ].map((n) => File(path.join(directory, n))), 19 | [ 20 | 'another_mapto.expected_multi', 21 | 'mapto.expected', 22 | ].map((n) => File(path.join(directory, n))), 23 | ); 24 | } 25 | -------------------------------------------------------------------------------- /packages/ejson_generator/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: ejson_generator 2 | description: >- 3 | EJSON serialization. 4 | 5 | BSON is a binary format used to store JSON-like documents efficiently. 6 | EJSON extends JSON defining how all BSON types should be represented in JSON. 7 | 8 | topics: 9 | - ejson 10 | - bson 11 | - json 12 | - build-runner 13 | - codegen 14 | 15 | version: 0.4.0 16 | repository: https://github.com/realm/realm-dart/ejson/packages/ejson_generator 17 | 18 | environment: 19 | sdk: ^3.6.0 20 | 21 | dependencies: 22 | analyzer: ^7.3.0 23 | build: '2.4.2' 24 | ejson_analyzer: ^0.4.1 25 | source_gen: ^2.0.0 26 | 27 | dev_dependencies: 28 | build_runner: ^2.4.14 29 | build_test: ^2.2.2 30 | dart_style: ^3.0.1 31 | ejson: ^0.4.0 32 | ejson_annotation: ^0.4.0 33 | lints: ^5.1.1 34 | meta: ^1.15.0 35 | test: ^1.25.9 36 | pub_semver: ^2.2.0 37 | -------------------------------------------------------------------------------- /packages/realm_dart/dev/lib/dev.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2024 MongoDB, Inc. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import 'dart:io' as io; 5 | 6 | import 'package:args/command_runner.dart'; 7 | import 'package:cli_launcher/cli_launcher.dart'; 8 | 9 | import 'src/build.dart'; 10 | 11 | Future main(List arguments, LaunchContext launchContext) async { 12 | final runner = CommandRunner('dev', 'Helper tool for building realm_dart') 13 | ..addCommand(BuildNativeCommand()) 14 | ..addCommand(PossibleTargets()) 15 | ..argParser.addFlag('verbose', abbr: 'v', help: 'Print verbose output', defaultsTo: false); 16 | try { 17 | final exitCode = await runner.run(arguments); 18 | io.exit(exitCode ?? 0); 19 | } on UsageException catch (error) { 20 | logger.err('$error'); 21 | io.exit(64); // Exit code 64 indicates a usage error. 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /packages/realm_dart/lib/src/handles/async_open_task_handle.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2024 MongoDB, Inc. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import '../realm_class.dart'; 5 | import 'handle_base.dart'; 6 | import 'native/async_open_task_handle.dart' if (dart.library.js_interop) 'web/async_open_task_handle.dart' as impl; 7 | import 'realm_handle.dart'; 8 | 9 | abstract interface class AsyncOpenTaskHandle extends HandleBase { 10 | factory AsyncOpenTaskHandle.from(FlexibleSyncConfiguration config) = impl.AsyncOpenTaskHandle.from; 11 | 12 | Future openAsync(CancellationToken? cancellationToken); 13 | void cancel(); 14 | 15 | AsyncOpenTaskProgressNotificationTokenHandle registerProgressNotifier( 16 | RealmAsyncOpenProgressNotificationsController controller, 17 | ); 18 | } 19 | 20 | abstract class AsyncOpenTaskProgressNotificationTokenHandle extends HandleBase {} -------------------------------------------------------------------------------- /packages/ejson_lint/example/bin/example.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2024 MongoDB, Inc. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import 'package:ejson_annotation/ejson_annotation.dart'; 5 | 6 | // This file is used to test lint rules using 7 | // dart run custom_lint 8 | class Person { 9 | final String name; 10 | // expect_lint: mismatched_getter_type 11 | final int age; 12 | 13 | @ejson 14 | // expect_lint: too_many_annotated_constructors 15 | Person(this.name, {required this.age}); 16 | 17 | @ejson 18 | // expect_lint: too_many_annotated_constructors, mismatched_getter_type 19 | Person.second(this.name, double age) : age = age.toInt(); 20 | 21 | @ejson 22 | // expect_lint: too_many_annotated_constructors, missing_getter 23 | Person.third(String navn, int alder) : this(navn, age: alder); 24 | } 25 | 26 | @ejson 27 | class Dog { 28 | late final Person owner; 29 | } 30 | -------------------------------------------------------------------------------- /packages/realm_dart/test/utils/platform_util.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2024 MongoDB, Inc. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import 'dart:typed_data'; 5 | 6 | import 'package:realm_dart/realm.dart'; 7 | 8 | import 'native/platform_util.dart' if (dart.library.js_interop) 'web/platform_util.dart' as impl; 9 | 10 | abstract interface class PlatformUtil { 11 | const factory PlatformUtil() = impl.PlatformUtil; 12 | 13 | String get systemTempPath; 14 | Future createTempPath(); 15 | String createTempPathSync(); 16 | Future sizeOnStorage(Configuration config); 17 | 18 | void printPlatformInfo(); 19 | 20 | Future copy(String fromPath, String toPath); 21 | Future readAsBytes(String path); 22 | 23 | Map get environment; 24 | 25 | int get maxInt; 26 | int get minInt; 27 | } 28 | 29 | const platformUtil = PlatformUtil(); 30 | -------------------------------------------------------------------------------- /packages/realm/linux/include/realm/realm_plugin.h: -------------------------------------------------------------------------------- 1 | #ifndef FLUTTER_PLUGIN_REALM_PLUGIN_H_ 2 | #define FLUTTER_PLUGIN_REALM_PLUGIN_H_ 3 | 4 | #include 5 | 6 | G_BEGIN_DECLS 7 | 8 | #ifdef FLUTTER_PLUGIN_IMPL 9 | #define FLUTTER_PLUGIN_EXPORT __attribute__((visibility("default"))) 10 | #else 11 | #define FLUTTER_PLUGIN_EXPORT 12 | #endif 13 | 14 | typedef struct _RealmPlugin RealmPlugin; 15 | typedef struct { 16 | GObjectClass parent_class; 17 | } RealmPluginClass; 18 | 19 | FLUTTER_PLUGIN_EXPORT GType realm_plugin_get_type(); 20 | 21 | FLUTTER_PLUGIN_EXPORT void realm_plugin_register_with_registrar( 22 | FlPluginRegistrar* registrar); 23 | 24 | FLUTTER_PLUGIN_EXPORT const char* realm_dart_get_app_directory(); 25 | 26 | FLUTTER_PLUGIN_EXPORT const char* realm_dart_get_bundle_id(); 27 | 28 | G_END_DECLS 29 | 30 | #endif // FLUTTER_PLUGIN_REALM_PLUGIN_H_ 31 | -------------------------------------------------------------------------------- /packages/realm/tests/linux/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | realm 7 | ) 8 | 9 | list(APPEND FLUTTER_FFI_PLUGIN_LIST 10 | ) 11 | 12 | set(PLUGIN_BUNDLED_LIBRARIES) 13 | 14 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 15 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) 16 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 17 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 18 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 19 | endforeach(plugin) 20 | 21 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) 22 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) 23 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) 24 | endforeach(ffi_plugin) 25 | -------------------------------------------------------------------------------- /packages/realm/tests/windows/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | realm 7 | ) 8 | 9 | list(APPEND FLUTTER_FFI_PLUGIN_LIST 10 | ) 11 | 12 | set(PLUGIN_BUNDLED_LIBRARIES) 13 | 14 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 15 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) 16 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 17 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 18 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 19 | endforeach(plugin) 20 | 21 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) 22 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) 23 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) 24 | endforeach(ffi_plugin) 25 | -------------------------------------------------------------------------------- /packages/realm_generator/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: realm_generator 2 | description: >- 3 | Generates RealmObject classes from Realm data model classes. 4 | This package is part of the official Realm Flutter and Realm Dart SDKs. 5 | 6 | version: 3.5.0 7 | 8 | homepage: https://www.realm.io 9 | repository: https://github.com/realm/realm-dart 10 | issue_tracker: https://github.com/realm/realm-dart/issues 11 | 12 | environment: 13 | sdk: ^3.6.0 14 | 15 | dependencies: 16 | analyzer: ^7.3.0 17 | build_resolvers: ^2.4.3 18 | build: '2.4.2' 19 | dart_style: ^3.0.1 20 | realm_common: ^3.5.0 21 | source_gen: ^2.0.0 22 | source_span: ^1.8.0 23 | collection: ^1.19.0 24 | 25 | dev_dependencies: 26 | build_runner: ^2.4.14 27 | build_test: ^2.2.2 28 | lints: ^5.1.1 29 | logging: ^1.2.0 30 | meta: ^1.15.0 31 | path: ^1.9.0 32 | term_glyph: ^1.2.0 33 | test: ^1.25.9 34 | pub_semver: ^2.2.0 35 | -------------------------------------------------------------------------------- /packages/realm/example/README.md: -------------------------------------------------------------------------------- 1 | ![Realm](https://github.com/realm/realm-dart/raw/master/logo.png) 2 | 3 | [![License](https://img.shields.io/badge/License-Apache-blue.svg)](LICENSE) 4 | 5 | # realm_example 6 | 7 | Demonstrates how to use the Realm SDK for Flutter™ 8 | 9 | ## Getting Started 10 | 11 | This project is a starting point for a Flutter application. 12 | 13 | A few resources to get you started if this is your first Flutter project: 14 | 15 | - [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab) 16 | - [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook) 17 | 18 | For help getting started with Flutter, view our 19 | [online documentation](https://flutter.dev/docs), which offers tutorials, 20 | samples, guidance on mobile development, and a full API reference. 21 | 22 | ##### The "Dart" name and logo and the "Flutter" name and logo are trademarks owned by Google. -------------------------------------------------------------------------------- /packages/realm/android/src/main/cpp/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.10) 2 | set(PROJECT_NAME "realm") 3 | 4 | project(${PROJECT_NAME} LANGUAGES CXX) 5 | 6 | set(PLUGIN_NAME "realm_plugin") 7 | 8 | #make cmake output visible in build log file 9 | set(CMAKE_VERBOSE_MAKEFILE TRUE CACHE BOOL "" FORCE) 10 | 11 | add_library(${PLUGIN_NAME} SHARED "realm_plugin.cpp") 12 | 13 | # print cmake variables 14 | #function(print_directory_variables dir) 15 | # # Dump variables: 16 | # get_property(_variableNames DIRECTORY ${dir} PROPERTY VARIABLES) 17 | # list (SORT _variableNames) 18 | # foreach (_variableName ${_variableNames}) 19 | # get_directory_property(_variableValue DIRECTORY ${dir} DEFINITION ${_variableName}) 20 | # message(STATUS "DIR ${dir}: ${_variableName}=${_variableValue}") 21 | # endforeach() 22 | #endfunction(print_directory_variables) 23 | # 24 | #print_directory_variables(.) -------------------------------------------------------------------------------- /.github/workflows/update-samples.yml: -------------------------------------------------------------------------------- 1 | name: Update samples release version 2 | on: 3 | release: 4 | types: [published] 5 | workflow_dispatch: 6 | 7 | jobs: 8 | update-samples-version: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - name: 'Get release version' 12 | id: release-version 13 | uses: pozetroninc/github-action-get-latest-release@d1dafdb6e338bdab109e6afce581a01858680dfb 14 | with: 15 | repository: ${{ github.repository }} 16 | 17 | - name: Trigger update samples CI 18 | run: | 19 | curl \ 20 | -X POST \ 21 | -H "Accept: application/vnd.github+json" \ 22 | -H "Authorization: Bearer ${{ secrets.REALM_CI_PAT }}" \ 23 | https://api.github.com/repos/realm/realm-dart-samples/actions/workflows/37091855/dispatches \ 24 | -d '{"ref":"main","inputs":{"version":"${{steps.release-version.outputs.release }}"}' -------------------------------------------------------------------------------- /packages/ejson_annotation/lib/ejson_annotation.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2023 MongoDB, Inc. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | /// Annotation to mark a class for extended json (ejson) serialization 5 | const ejson = EJson(); 6 | 7 | /// Annotation to mark a class for extended json (ejson) serialization 8 | class EJson { 9 | final EJsonEncoder? encoder; 10 | final EJsonDecoder? decoder; 11 | 12 | const EJson._(this.encoder, this.decoder); 13 | const EJson() : this._(null, null); 14 | const EJson.custom({required EJsonEncoder this.encoder, required EJsonDecoder this.decoder}); 15 | } 16 | 17 | typedef EJsonDecoder = T Function(EJsonValue ejson); 18 | 19 | typedef EJsonEncoder = EJsonValue Function(T object); 20 | 21 | // while we wait for 22 | // typedef EJsonValue = Null | String | bool | int | double | List | Map; 23 | typedef EJsonValue = Object?; 24 | -------------------------------------------------------------------------------- /packages/realm/tests/ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 12.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /packages/realm_dart/lib/src/cli/generate/options.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2024 MongoDB, Inc. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import 'package:build_cli_annotations/build_cli_annotations.dart'; 5 | 6 | part 'options.g.dart'; 7 | 8 | @CliOptions() 9 | class Options { 10 | @CliOption(defaultsTo: false, help: "Optional. Cleans generator caches. Same as running 'dart run build_runner clean'") 11 | bool clean = false; 12 | 13 | @CliOption( 14 | defaultsTo: false, 15 | help: 16 | "Optional. Watches for changes and generates RealmObjects classes on the background. Same as running 'dart run build_runner watch --delete-conflicting-outputs'") 17 | bool watch = false; 18 | } 19 | 20 | String get usage => _$parserForOptions.usage; 21 | 22 | ArgParser populateOptionsParser(ArgParser p) => _$populateOptionsParser(p); 23 | 24 | Options parseOptionsResult(ArgResults results) => _$parseOptionsResult(results); 25 | -------------------------------------------------------------------------------- /packages/realm_generator/test/good_test_data/primary_key.dart: -------------------------------------------------------------------------------- 1 | import 'package:realm_common/realm_common.dart'; 2 | 3 | part 'primary_key.realm.dart'; 4 | 5 | @RealmModel() 6 | class _IntPK { 7 | @PrimaryKey() 8 | late int id; 9 | } 10 | 11 | @RealmModel() 12 | class _NullableIntPK { 13 | @PrimaryKey() 14 | late int? id; 15 | } 16 | 17 | @RealmModel() 18 | class _StringPK { 19 | @PrimaryKey() 20 | late String id; 21 | } 22 | 23 | @RealmModel() 24 | class _NullableStringPK { 25 | @PrimaryKey() 26 | late String? id; 27 | } 28 | 29 | @RealmModel() 30 | class _ObjectIdPK { 31 | @PrimaryKey() 32 | late ObjectId id; 33 | } 34 | 35 | @RealmModel() 36 | class _NullableObjectIdPK { 37 | @PrimaryKey() 38 | late ObjectId? id; 39 | } 40 | 41 | @RealmModel() 42 | class _UuidPK { 43 | @PrimaryKey() 44 | late Uuid id; 45 | } 46 | 47 | @RealmModel() 48 | class _NullableUuidPK { 49 | @PrimaryKey() 50 | late Uuid? id; 51 | } 52 | -------------------------------------------------------------------------------- /packages/realm/ios/Classes/RealmPlugin.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright 2021 Realm Inc. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); 6 | // you may not use this file except in compliance with the License. 7 | // You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | // See the License for the specific language governing permissions and 15 | // limitations under the License. 16 | // 17 | //////////////////////////////////////////////////////////////////////////////// 18 | 19 | #import 20 | 21 | @interface RealmPlugin : NSObject 22 | @end 23 | -------------------------------------------------------------------------------- /packages/realm_dart/lib/src/cli/common/target_os_type.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2021 MongoDB, Inc. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import 'utils.dart'; 5 | 6 | enum TargetOsType { 7 | android, 8 | ios, 9 | linux, 10 | macos, 11 | windows; 12 | 13 | bool get isDesktop => [TargetOsType.linux, TargetOsType.macos, TargetOsType.windows].contains(this); 14 | } 15 | 16 | // Cannot use Dart 2.17 enhanced enums, due to an issue with build_cli :-/ 17 | enum Flavor { 18 | flutter, 19 | dart; 20 | } 21 | 22 | extension FlavorEx on Flavor { 23 | String get packageName => switch (this) { Flavor.dart => 'realm_dart', Flavor.flutter => 'realm' }; 24 | } 25 | 26 | extension StringEx on String { 27 | TargetOsType? get asTargetOsType => TargetOsType.values.where((element) => element.toString().split('.').last == this).firstOrNull; 28 | Flavor? get asFlavor => Flavor.values.where((element) => element.toString() == this).firstOrNull; 29 | } 30 | -------------------------------------------------------------------------------- /packages/realm_dart/lib/src/handles/results_handle.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2024 MongoDB, Inc. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import 'package:realm_dart/src/handles/handle_base.dart'; 5 | import 'package:realm_dart/src/handles/notification_token_handle.dart'; 6 | 7 | import '../realm_class.dart'; 8 | import 'object_handle.dart'; 9 | import 'realm_handle.dart'; 10 | 11 | abstract interface class ResultsHandle extends HandleBase { 12 | ResultsHandle queryResults(String query, List args); 13 | 14 | int find(Object? value); 15 | 16 | ObjectHandle getObjectAt(int index); 17 | 18 | int get count; 19 | 20 | bool isValid(); 21 | 22 | void deleteAll(); 23 | ResultsHandle snapshot(); 24 | ResultsHandle resolveIn(RealmHandle realmHandle); 25 | 26 | Object? elementAt(Realm realm, int index); 27 | NotificationTokenHandle subscribeForNotifications(NotificationsController controller, List? keyPaths, int? classKey); 28 | } 29 | -------------------------------------------------------------------------------- /packages/realm_generator/test/error_test.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | 3 | import 'package:realm_generator/realm_generator.dart'; 4 | import 'package:test/test.dart'; 5 | import 'package:term_glyph/term_glyph.dart'; 6 | import 'test_util.dart'; 7 | 8 | void main() async { 9 | const directory = 'test/error_test_data'; 10 | ascii = false; // force unicode glyphs 11 | 12 | await for (final errorFile in Directory(directory).list(recursive: true).where((f) => f.path.endsWith('.expected')).cast()) { 13 | final sourceFile = File(errorFile.path.replaceFirst('.expected', '.dart')); 14 | testCompile( 15 | 'compile $sourceFile', 16 | sourceFile, 17 | throwsA( 18 | isA().having( 19 | (e) => e.format().trim().normalizeLineEndings(), 20 | 'format', 21 | (await errorFile.readAsString()).trim().normalizeLineEndings(), 22 | ), 23 | ), 24 | ); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /packages/realm/tests/android/settings.gradle: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | def flutterSdkPath = { 3 | def properties = new Properties() 4 | file("local.properties").withInputStream { properties.load(it) } 5 | def flutterSdkPath = properties.getProperty("flutter.sdk") 6 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties" 7 | return flutterSdkPath 8 | } 9 | settings.ext.flutterSdkPath = flutterSdkPath() 10 | 11 | includeBuild("${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle") 12 | 13 | repositories { 14 | google() 15 | mavenCentral() 16 | gradlePluginPortal() 17 | } 18 | 19 | plugins { 20 | id "dev.flutter.flutter-gradle-plugin" version "1.0.0" apply false 21 | } 22 | } 23 | 24 | plugins { 25 | id "dev.flutter.flutter-plugin-loader" version "1.0.0" 26 | id "com.android.application" version '8.7.0' apply false 27 | } 28 | 29 | include ":app" 30 | -------------------------------------------------------------------------------- /packages/realm/ios/Resources/PrivacyInfo.xcprivacy: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NSPrivacyTrackingDomains 6 | 7 | NSPrivacyCollectedDataTypes 8 | 9 | NSPrivacyAccessedAPITypes 10 | 11 | 12 | NSPrivacyAccessedAPITypeReasons 13 | 14 | C617.1 15 | 16 | NSPrivacyAccessedAPIType 17 | NSPrivacyAccessedAPICategoryFileTimestamp 18 | 19 | 20 | NSPrivacyAccessedAPITypeReasons 21 | 22 | E174.1 23 | 24 | NSPrivacyAccessedAPIType 25 | NSPrivacyAccessedAPICategoryDiskSpace 26 | 27 | 28 | NSPrivacyTracking 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /packages/realm/macos/Resources/PrivacyInfo.xcprivacy: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NSPrivacyTrackingDomains 6 | 7 | NSPrivacyCollectedDataTypes 8 | 9 | NSPrivacyAccessedAPITypes 10 | 11 | 12 | NSPrivacyAccessedAPITypeReasons 13 | 14 | C617.1 15 | 16 | NSPrivacyAccessedAPIType 17 | NSPrivacyAccessedAPICategoryFileTimestamp 18 | 19 | 20 | NSPrivacyAccessedAPITypeReasons 21 | 22 | E174.1 23 | 24 | NSPrivacyAccessedAPIType 25 | NSPrivacyAccessedAPICategoryDiskSpace 26 | 27 | 28 | NSPrivacyTracking 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /packages/realm_dart/lib/src/cli/archive/options.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'options.dart'; 4 | 5 | // ************************************************************************** 6 | // CliGenerator 7 | // ************************************************************************** 8 | 9 | Options _$parseOptionsResult(ArgResults result) => Options( 10 | sourceDir: result['source-dir'] as String?, 11 | outputFile: result['output-file'] as String?, 12 | ); 13 | 14 | ArgParser _$populateOptionsParser(ArgParser parser) => parser 15 | ..addOption( 16 | 'source-dir', 17 | help: 'This option is required', 18 | ) 19 | ..addOption( 20 | 'output-file', 21 | help: 'This option is required', 22 | ); 23 | 24 | final _$parserForOptions = _$populateOptionsParser(ArgParser()); 25 | 26 | Options parseOptions(List args) { 27 | final result = _$parserForOptions.parse(args); 28 | return _$parseOptionsResult(result); 29 | } 30 | -------------------------------------------------------------------------------- /packages/realm_dart/lib/src/cli/extract/options.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'options.dart'; 4 | 5 | // ************************************************************************** 6 | // CliGenerator 7 | // ************************************************************************** 8 | 9 | Options _$parseOptionsResult(ArgResults result) => Options( 10 | sourceFile: result['source-file'] as String?, 11 | outputDir: result['output-dir'] as String?, 12 | ); 13 | 14 | ArgParser _$populateOptionsParser(ArgParser parser) => parser 15 | ..addOption( 16 | 'output-dir', 17 | help: 'This option is required', 18 | ) 19 | ..addOption( 20 | 'source-file', 21 | help: 'This option is required', 22 | ); 23 | 24 | final _$parserForOptions = _$populateOptionsParser(ArgParser()); 25 | 26 | Options parseOptions(List args) { 27 | final result = _$parserForOptions.parse(args); 28 | return _$parseOptionsResult(result); 29 | } 30 | -------------------------------------------------------------------------------- /packages/realm_generator/test/good_test_data/realm_set.dart: -------------------------------------------------------------------------------- 1 | import 'package:realm_common/realm_common.dart'; 2 | 3 | part 'realm_set.realm.dart'; 4 | 5 | @RealmModel() 6 | class _Car { 7 | @PrimaryKey() 8 | late String make; 9 | } 10 | 11 | @RealmModel() 12 | class _RealmSets { 13 | @PrimaryKey() 14 | late int key; 15 | 16 | late Set boolSet; 17 | late Set nullableBoolSet; 18 | 19 | late Set intSet; 20 | late Set nullableintSet; 21 | 22 | late Set stringSet; 23 | late Set nullablestringSet; 24 | 25 | late Set doubleSet; 26 | late Set nullabledoubleSet; 27 | 28 | late Set dateTimeSet; 29 | late Set nullabledateTimeSet; 30 | 31 | late Set objectIdSet; 32 | late Set nullableobjectIdSet; 33 | 34 | late Set uuidSet; 35 | late Set nullableuuidSet; 36 | 37 | late Set realmValueSet; 38 | late Set<_Car> realmObjectsSet; 39 | } 40 | -------------------------------------------------------------------------------- /packages/realm_dart/lib/src/handles/subscription_set_handle.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2024 MongoDB, Inc. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import 'package:cancellation_token/cancellation_token.dart'; 5 | 6 | import '../subscription.dart'; 7 | import 'handle_base.dart'; 8 | import 'mutable_subscription_set_handle.dart'; 9 | import 'results_handle.dart'; 10 | import 'subscription_handle.dart'; 11 | 12 | abstract class SubscriptionSetHandle extends HandleBase { 13 | void refresh(); 14 | 15 | int get size; 16 | 17 | Exception? get error; 18 | 19 | SubscriptionHandle operator [](int index); 20 | 21 | SubscriptionHandle? findByName(String name); 22 | 23 | SubscriptionHandle? findByResults(ResultsHandle results); 24 | 25 | int get version; 26 | SubscriptionSetState get state; 27 | 28 | MutableSubscriptionSetHandle toMutable(); 29 | 30 | Future waitForStateChange(SubscriptionSetState notifyWhen, [CancellationToken? cancellationToken]); 31 | } 32 | -------------------------------------------------------------------------------- /packages/realm_generator/test/info_test.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | 3 | import 'package:term_glyph/term_glyph.dart'; 4 | import 'package:test/test.dart'; 5 | 6 | import 'test_util.dart'; 7 | 8 | void main() async { 9 | const directory = 'test/info_test_data'; 10 | ascii = false; // force unicode glyphs 11 | 12 | await for (final infoFile in Directory(directory).list(recursive: true).where((f) => f.path.endsWith('.expected')).cast()) { 13 | final sourceFile = File(infoFile.path.replaceFirst('.expected', '.dart')); 14 | String? firstLog; 15 | testCompile( 16 | 'log from compile $sourceFile', 17 | sourceFile, 18 | completion(predicate((_) { 19 | return firstLog?.normalizeLineEndings() == infoFile.readAsStringSync().normalizeLineEndings(); 20 | })), 21 | onLog: (record) { 22 | if (firstLog == null && record.loggerName == 'testBuilder') { 23 | firstLog = '$record'; 24 | } 25 | }, 26 | ); 27 | } 28 | } 29 | --------------------------------------------------------------------------------