Skip to content

Instantly share code, notes, and snippets.

@collinjackson
Created February 8, 2016 23:32
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 collinjackson/b7af2b2fc2349594e1f1 to your computer and use it in GitHub Desktop.
Save collinjackson/b7af2b2fc2349594e1f1 to your computer and use it in GitHub Desktop.
/// Configurable state of an input field.
class InputValue {
const InputValue({ this.text: '', this.selection });
/// The current text being edited.
String text;
/// The range of text that is currently selected.
TextSelection selection;
static InputValue get empty => const InputValue();
bool operator==(Object other) {
if (other.runtimeType != runtimeType)
return false;
InputValue otherValue = other;
return (otherValue.text == text) &&
(otherValue.selection == selection);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment