Skip to content

Flutter

bootstraponline edited this page May 21, 2019 · 8 revisions

IDE config

  • Preferences | Editor | General | Appearance, check Show closing labels in Dart source code
  • Preferences | Editor | Font, set Size to 18
  • Preferences | Appearance & Behavior | Appearance, set Theme to Darcula and check Use dark window headers
  • Preferences | Languages & Frameworks | Flutter, check Format code on save and Perform hot reload on save
  • Preferences | Languages & Frameworks | Flutter, uncheck Hide closing labels in Dart source code when UI guides are on

IDE shortcuts

Hide debug banner

  • Flutter Inspector | More Actions click Hide Debug Mode Banner

Path setup

~/.bash_profile

# flutter
export PATH="$PATH:$HOME/flutter/bin"
export PATH="$PATH:$HOME/flutter/.pub-cache/bin"
export PATH="$PATH:$HOME/flutter/bin/cache/dart-sdk/bin"

Flutter Web

Flutter web requires changing imports. Not compatible with published packages.

Channels

  • flutter channel

Emulator

Error connecting to the service protocol: HttpException: Connection closed before full header was received, uri = http://127.0.0.1:49400/dU8Teio-2x8=/ws

Use emulator on API 28. Q image is currently broken.

Hot reload requires app class

// will hot reload
import 'package:flutter/material.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Center(
        child: Text("hello 2"),
      ),
    );
  }
}
// will not hot reload (main not re-executed)
import 'package:flutter/material.dart';

void main() {
  runApp(
    MaterialApp(
      home: Center(
        child: Text("hello"),
      ),
    ),
  );
}

App icon generation

Clone this wiki locally