Useful Resources

Free Illustrations & Icons

Blog Posts

Android Studio Hotkeys

Cursor on the Widget

  • Alt + Enter = Context Actions
  • ctrl J = Quick Docs (everything you can set)
  • Cmd + Click on widget = Show Flutter Outline

Code Samples

https://dartpad.dartlang.org/

Packages

http://pub.dev

Cool Videos

How to launch an app in a week? Mr. D

Stateless vs Stateful Widgets

Stateless widgets are not dynamic and the contents should not change.

Museum exhibit = Stateless Widget

Your bedroom = Stateful Widget

Google Codelabs for Flutter

https://codelabs.developers.google.com/?cat=Flutter

Flutter Architecture Code Samples

http://fluttersamples.com/

State Management

https://itnext.io/what-state-management-should-you-choose-for-flutter-3f76716d99fe

Flutter for Web?

https://www.reddit.com/r/FlutterDev/comments/fl53re/is_flutter_web_ever_going_to_be_a_thing/

Flutter with Rails Backend

https://github.com/flippakitten/frap/

Flutter iFrame/Webview

https://flatteredwithflutter.com/flutter-web-and-iframe/

Function Returning a Widget

<Widget> functionName() {
  return <Widget>(
    child: <anotherWidget>,
    otherProperty: foo,
  );
}

Expanded buildKey({Color color, int soundNumber}) {
  return Expanded(
    child: FlatButton(),
  );
}

Create TODO in Android Studio

//TODO: put what you want to do here

Lists

List<Icon> scoreKeeper = [
    Icon(
      Icons.check,
      color: Colors.green,
    ),
    Icon(
      Icons.close,
      color: Colors.red,
    )
  ];

List<Widget> scoreKeeper = [
    Icon(
      Icons.check,
      color: Colors.green,
    ),
    Icon(
      Icons.close,
      color: Colors.red,
    )
  ];

scoreKeeper.add(Icon(Icons.check, color: Colors.green))

Dartpad Trick

paste the UUID from github gist into the url bar for dartpad
e.g. dartpad.dartlang.org/UUID

It will autoload that code into dartpad

Android Studio Version Control

Top Menu -> VCS -> Local History -> Show History

Android Studio Project-Level Dictionary

Add your class names to project-level dictionary

alt + Enter -> Save to Project-Level Dictionary

Dart Algorithms Course Exercism.io

https://exercism.io/my/tracks/dart

OOP Stuff

Abstraction = make something complex into simple parts with defined roles

Encapsulation = add an underscore before a function to make it a private function

Inheritance = classes can inherit functionality from parents, using extends keyword in dart

Polymorphism = override inherited functions using @override void functionName, you can also call the parent function with super.functionName

Websockets

https://www.reddit.com/r/dartlang/comments/hfs6po/documentation_or_a_tutorial_for_websockets_with/

Constructor Trick

this in Dart = self in Ruby

void main() {
  Human trevor = Human(height: 20, weight: 100);
}

class Human {
  double height;
  double weight;
  Human({this.height, this.weight});  // will auto assign passed values
}

Clima Weather App

void getLocation() async {
    Position position = await Geolocator().getCurrentPosition(desiredAccuracy: LocationAccuracy.high);
}

put async after function name

LOCATION PERMISSIONS