Skip to content

Instantly share code, notes, and snippets.

@rahulkhatri19
Created July 26, 2020 12:24
Show Gist options
  • Save rahulkhatri19/6fd5beb63216c0f644514541e12010da to your computer and use it in GitHub Desktop.
Save rahulkhatri19/6fd5beb63216c0f644514541e12010da to your computer and use it in GitHub Desktop.
Dart Basic

Dart Basic for Java

Class in dart

  • All elem

  • Constructors

Bicycle(this.wheel, this.speed, this.gear);

In Java

Bicycle(int wheel, int speed, int gear){ this.wheel; this.speed; this.gear; }

class Bicycle { int cadence; int _speed = 0; int get speed => _speed; int gear;

Bicycle(this.cadence, this.gear);

void applyBrake(int decrement) { _speed -= decrement; }

void speedUp(int increment) { _speed += increment; }

@override String toString() => 'Bicycle: $_speed mph'; }

void main() { var bike = Bicycle(2, 1); print(bike); }

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