[Flutter]开发记录

本文详细介绍如何在macOS系统上配置Flutter开发环境,包括安装官方SDK、设置全局命令、部署iOS设备、安装Android Studio插件等步骤,并提供了一个简单的示例项目。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1.官网:https://flutter.io/setup-macos/#system-requirements

2.准备SDK:https://flutter.io/setup-macos/

3.Add the flutter tool to your path:[macOS]设置全局命令

 

open ~/.bash_profile
 
export PATH=[PATH_TO_FLUTTER_GIT_DIRECTORY]/flutter/bin:$PATH
 
source ~/.bash_profile
 刷新profile
4.Deploy to iOS devices:

 

 

brew update
$ brew install --HEAD libimobiledevice
$ brew install ideviceinstaller ios-deploy cocoapods
$ pod setup
 brew doctor可以看到错误和建议

 

5.Android studio 安装dart & flutter插件.先安装dart,要不可能报错

 

5.flutter doctor检查

补充完插件\IDE等等

 

6.Android studio new file->new flutter project

 

7.Use an external package

 In pubspec.yaml, add english_words (3.1.0 or higher) to the dependencies list. Add the highlighted line below:

 

dependencies:
  flutter:
    sdk: flutter

  cupertino_icons: ^0.1.0
  english_words: ^3.1.0
 While viewing the pubspec in Android Studio’s editor view, click Packages get.

 

 

In lib/main.dart, import the new package:

 

import 'package:flutter/material.dart';
import 'package:english_words/english_words.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    final wordPair = WordPair.random();
    return MaterialApp(
      title: 'Welcome to Flutter',
      home: Scaffold(
        appBar: AppBar(
          title: Text('Welcome to Flutter'),
        ),
        body: Center(
          //child: Text('Hello World'), // Replace the highlighted text...
          child: Text(wordPair.asPascalCase),  // With this highlighted text.
        ),
      ),
    );
  }
}

 

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值