Flutter---mac配置
2018-03-20 本文已影响0人
哲蓝
前提:mac环境下
1、下载flutter
$ git clone -b beta https://github.com/flutter/flutter.git
2、配置环境变量
$ subl ~/.bash_profile
添加
export PATH_TO_FLUTTER_GIT_DIRECTORY=/Users/Mac/flutter
export PATH=${PATH}:${PATH_TO_FLUTTER_GIT_DIRECTORY}/bin
3、安装flutter
flutter doctor
4、Android studio 安装flutter插件
5、新建一个flutter项目
New--- new flutter project
6、hello world
找到main.dart文件
import 'package:flutter/material.dart';
void main() => runApp(new MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new MaterialApp(
title: 'Welcome to Flutter',
home: new Scaffold(
appBar: new AppBar(
title: new Text('Welcome to Flutter'),
),
body: new Center(
child: new Text('Hello World'),
),
),
);
}
}