Skip to content

Instantly share code, notes, and snippets.

@Sfshaza
Last active May 3, 2018 21:58
Show Gist options
  • Save Sfshaza/24b24776b4469181b7b5a6040f0fb8a8 to your computer and use it in GitHub Desktop.
Save Sfshaza/24b24776b4469181b7b5a6040f0fb8a8 to your computer and use it in GitHub Desktop.
Java-to-Dart codelab: Final Bicycle example
class Bicycle {
int cadence;
int _speed;
int gear;
Bicycle(this.cadence, this._speed, this.gear);
int get speed => _speed;
void applyBrake(int decrement) {
_speed -= decrement;
}
void speedUp(int increment) {
_speed += increment;
}
@override
String toString() => 'Bicycle: $_speed mph';
}
main() {
var bike = new Bicycle(2, 0, 1);
print(bike);
}
@kwalrath
Copy link

kwalrath commented May 3, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment