Skip to content

Instantly share code, notes, and snippets.

@hawkkiller
Last active July 9, 2023 17:24
Show Gist options
  • Select an option

  • Save hawkkiller/69b8fa9468d4d09ce0f79c2538c5f12d to your computer and use it in GitHub Desktop.

Select an option

Save hawkkiller/69b8fa9468d4d09ce0f79c2538c5f12d to your computer and use it in GitHub Desktop.
LSP signature requirement violation
class Bird {
void fly() {
print('The bird is flying.');
}
}
class Ostrich extends Bird {
@override
void fly() {
throw UnsupportedError('Ostriches cannot fly.');
}
}
void fly(Bird bird) {
/// we expect there that we receive an object able to fly
birf.fly();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment