Skip to content

Commit

Permalink
Simplify with switch expression
Browse files Browse the repository at this point in the history
  • Loading branch information
nielsenko committed Apr 18, 2024
1 parent 878141c commit 1153c43
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions packages/realm_common/lib/src/realm_types.dart
Original file line number Diff line number Diff line change
Expand Up @@ -85,18 +85,12 @@ enum RealmCollectionType {
_3, // ignore: unused_field, constant_identifier_names
map;

String get plural {
switch (this) {
case RealmCollectionType.list:
return "lists";
case RealmCollectionType.set:
return "sets";
case RealmCollectionType.map:
return "maps";
default:
return "none";
}
}
String get plural => switch (this) {
RealmCollectionType.list => 'lists',
RealmCollectionType.set => 'sets',
RealmCollectionType.map => 'maps',
_ => 'none'
};
}

/// A base class of all Realm errors.
Expand Down

0 comments on commit 1153c43

Please sign in to comment.