Created
December 14, 2018 20:17
-
-
Save HansMuller/793b7a2b7fd35a2def4337315918a26d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Model { | |
const Model({ this.value = 0 }); | |
final int value; | |
@override | |
bool operator ==(Object other) { | |
if (identical(this, other)) | |
return true; | |
if (other.runtimeType != runtimeType) | |
return false; | |
final Model otherModel = other; | |
return otherModel.value == value; | |
} | |
@override | |
int get hashCode => value.hashCode; | |
static Model of(BuildContext context) { | |
final ModelBinding binding = context.inheritFromWidgetOfExactType(ModelBinding); | |
return binding.model; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment