Commit 4e47bced by Maurits van Beusekom Committed by GitHub

Merge pull request #489 from timekone/develop

Implement the equality operator for Permission class
parents 63565a5c 055958a1
...@@ -11,6 +11,7 @@ class PermissionWithService extends Permission { ...@@ -11,6 +11,7 @@ class PermissionWithService extends Permission {
} }
/// Defines the permissions which can be checked and requested. /// Defines the permissions which can be checked and requested.
@immutable
class Permission { class Permission {
const Permission._(this.value); const Permission._(this.value);
factory Permission.byValue(int value) => values[value]; factory Permission.byValue(int value) => values[value];
...@@ -163,4 +164,18 @@ class Permission { ...@@ -163,4 +164,18 @@ class Permission {
@override @override
String toString() => 'Permission.${_names[value]}'; String toString() => 'Permission.${_names[value]}';
@override
bool operator ==(Object other) {
if (identical(this, other)) {
return true;
}
if (other.runtimeType != runtimeType) {
return false;
}
return other is Permission && other.value == value;
}
@override
int get hashCode => value.hashCode;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment