I hereby claim:
- I am eltray on github.
- I am eltray (https://keybase.io/eltray) on keybase.
- I have a public key ASBLIysibuUrVUXrlRBu4Kw8wSokRW3GgKyZOXLiG4xVGgo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
String scream(int length) => "A${"a" * length}h!"; | |
main() { | |
var values = [1, 2, 3, 4, 10]; | |
// Imperative way | |
// for (int length in values){ | |
// print(scream(length)); | |
// } | |
// Functional way | |
// values.map(scream).forEach(print); |
import 'dart:math' as math; | |
abstract class Shape { | |
num get area; | |
factory Shape(String type) { | |
if (type == 'circle') return Circle(2); | |
if (type == 'square') return Square(2); | |
throw 'Can\'t create $type'; | |
} | |
} |
import 'dart:math' as math; | |
abstract class Shape { | |
num get area; | |
factory Shape(String type) { | |
if (type == 'circle') return Circle(2); | |
if (type == 'square') return Square(2); | |
throw 'Can\'t create $type'; | |
} | |
} |
import 'dart:math' as math; | |
abstract class Shape { | |
num get area; | |
} | |
class Circle implements Shape { | |
final num radius; | |
num get area => math.pi * math.pow(radius, 2); |
import 'dart:math'; | |
class Rectangle { | |
int width; | |
int height; | |
Point origin; | |
Rectangle({this.origin = const Point(0, 0), this.width = 0, this.height = 0}); | |
@override |
class Bicycle { | |
int _speed = 0; | |
int get speed => _speed; | |
int cadence; | |
int wheel; | |
Bicycle({this.cadence = 0, this.wheel = 0}); | |
@override | |
String toString() => |
class Bicycle { | |
int _speed = 0; | |
int get speed => _speed; | |
int cadence; | |
int wheel; | |
Bicycle({this.cadence = 0, this.wheel = 0}); | |
@override | |
String toString() => |