Commit 055958a1 by Dmitry Belogub

Implement equality for Permission

parent eb7ef50a
library permission_handler_platform_interface;
import 'dart:async';
import 'package:meta/meta.dart';
import 'package:plugin_platform_interface/plugin_platform_interface.dart';
import 'src/method_channel/method_channel_permission_handler.dart';
......
......@@ -8,6 +8,7 @@ class PermissionWithService extends Permission {
}
/// Defines the permissions which can be checked and requested.
@immutable
class Permission {
const Permission._(this.value);
factory Permission.byValue(int value) => values[value];
......@@ -146,4 +147,18 @@ class Permission {
@override
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