Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Samples and tests updated with relaxed final constraint for primary keys and properties #248

Merged
merged 16 commits into from
Feb 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion example/bin/myapp.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ part 'myapp.g.dart';

@RealmModel()
class _Car {
late final String make;
late String make;
String? model;
int? kilometers = 500;
_Person? owner;
Expand Down
21 changes: 6 additions & 15 deletions example/bin/myapp.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion flutter/realm_flutter/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ part 'main.g.dart';

@RealmModel()
class _Car {
late final String make;
late String make;
String? model;
int? kilometers = 500;
_Person? owner;
Expand Down
21 changes: 6 additions & 15 deletions flutter/realm_flutter/example/lib/main.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions test/realm_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ part 'realm_test.g.dart';
@RealmModel()
class _Car {
@PrimaryKey()
late final String make;
late String make;
}

@RealmModel()
Expand All @@ -42,7 +42,7 @@ class _Person {
@RealmModel()
class _Dog {
@PrimaryKey()
late final String name;
late String name;

late int? age;

Expand All @@ -52,14 +52,14 @@ class _Dog {
@RealmModel()
class _Team {
late String name;
late final List<_Person> players;
late final List<int> scores;
late List<_Person> players;
late List<int> scores;
}

@RealmModel()
class _Student {
@PrimaryKey()
late final int number;
late int number;
late String? name;
late int? yearOfBirth;
late _School? school;
Expand All @@ -68,11 +68,11 @@ class _Student {
@RealmModel()
class _School {
@PrimaryKey()
late final String name;
late String name;
late String? city;
final List<_Student> students = [];
List<_Student> students = [];
late _School? branchOfSchool;
late final List<_School> branches;
late List<_School> branches;
}

String? testName;
Expand Down Expand Up @@ -402,7 +402,7 @@ Future<void> main([List<String>? args]) async {

expect(() {
realm.write(() {
car.make = "Audi"; // setting late final is a runtime error :-/
car.make = "Audi";
});
}, throws<RealmUnsupportedSetError>());

Expand Down
21 changes: 12 additions & 9 deletions test/realm_test.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.