Skip to content

Instantly share code, notes, and snippets.

@alexd1971
Created April 28, 2018 18:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexd1971/b584b27382a7e77ed3e4ae40063668a8 to your computer and use it in GitHub Desktop.
Save alexd1971/b584b27382a7e77ed3e4ae40063668a8 to your computer and use it in GitHub Desktop.
class UserId {
String _id;
UserId(this._id);
@override
bool operator == (other) {
return _id == other._id;
}
int get hashCode => _id.hashCode;
}
void main() {
final map = new Map<UserId,int>();
var a = new UserId('1');
var b = new UserId('2');
map[a] = 1;
map[b] = 2;
print(map[new UserId('1')]);
print(map[new UserId('2')]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment