AppBrewery - Xylophone Flashcards

1
Q

how to add dependencies

A

in pubspec.yaml, add under dependencies

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

dependency sytnax

A

`dependencies:

(optional>)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

stless widget constructor for widget properties

A
class KeyNote extends StatelessWidget {
  final Color color;
  final int assetNumber;
  const KeyNote({
    Key key,
    this.color,
    this.assetNumber,
  }) : super (key: key);
  @override
  Widget build(BuildContext context) {
    return Padding(
      padding: const EdgeInsets.only(bottom: 10.0),
      child: FlatButton(
        color: color,
        onPressed: playNote,
      ),
    );
  }
  void playNote () {
    final player = AudioCache();
    player.play('note$assetNumber.wav');
  }
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

named, optional Dart function parameters

A

A parameter wrapped by [ ] is a positional optional parameter. Here is an example:

getHttpUrl(String server, String path, [int port=80]) {
  // ...
}
A parameter wrapped by { } is a named optional parameter.
foo({@required String name}) {...}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

on column or row, stretch along main axis for available space

A

expanded wraps children

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

type dart functions?

A

if returning, type function of return; int getMilk() { //… return 1}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

num dart

A

either int or floating point number type

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

dart fat arrow syntax, equivalent

A

The ` => expr syntax is a shorthand for { return expr; } `

How well did you know this?
1
Not at all
2
3
4
5
Perfectly