美文网首页
Flutter---mac配置

Flutter---mac配置

作者: 哲蓝 | 来源:发表于2018-03-20 10:46 被阅读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'),
            ),
          ),
        );
      }
    }
    

    7、运行结果

    image

    相关文章

      网友评论

          本文标题:Flutter---mac配置

          本文链接:https://www.haomeiwen.com/subject/amyvqftx.html