美文网首页
Flutter-HelloWorld

Flutter-HelloWorld

作者: 杰克大王 | 来源:发表于2020-11-21 17:11 被阅读0次

    Flutter 第一个程序

    环境

    • mac
    • vscode
    • flutter version 1.17.5

    new Project

    安装完flutter 插件后
    可以在vscode 的 command palettle 中使用 flutter New Project 来新建项目

    Project folder

    ┬
    └ projectname
      ┬
      ├ android      - Android部分的工程文件
      ├ build        - 项目的构建输出目录
      ├ ios          - iOS部分的工程文件
      ├ lib          - 项目中的Dart源文件
        ┬
        └ src        - 包含其他源文件
        └ main.dart  - 自动生成的项目入口文件,类似RN的index.js文件
      ├ test         - 测试相关文件
      └ pubspec.yaml - 项目依赖配置文件类似于RN的 package.json 
    
    image.png

    还有一些隐藏文件

    .dart_tool

    Don’t commit the following files and directories created by pub:
    
    .dart_tool/
    .packages
    build/
    pubspec.lock  # Except for application packages
    Note: The .dart_tool directory, which is new in Dart 2, is used by pub and other tools. 
    It replaces the .pub directory as of the 2.0.0-dev.32.0 SDK release. 
    The .packages file replaces the packages directories that early Dart versions produced.
    

    .idea

    Don’t commit files and directories created by other development environments.
    For example, if your development environment creates any of the following files, 
    consider putting them in a global ignore file:
    # IntelliJ
    *.iml
    *.ipr
    *.iws
    .idea/
    
    # Mac
    .DS_Store
    

    生成的 .gitignore 已经帮我们屏蔽了这些文件了

    main.dart

    这部分 入口函数及代码的讲解,可以参考
    https://book.flutterchina.club/chapter2/first_flutter_app.html

    参考资料

    https://juejin.cn/post/6844903812059119630
    https://dart.dev/guides/libraries/private-files#the-rules

    相关文章

      网友评论

          本文标题:Flutter-HelloWorld

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