Configure the Flutter plug-in in Android Studio and create a small project "hello world"

1. Download Flutter SDK

Open the official websitehttps://flutter.io/setup-windows/DownloadFlutter sdk and unzip it to a directory
Insert image description here
Insert image description here
Insert image description here

2. Install the Flutter plug-in in Android studio

Android studioFlutterInstall plug-in in and check again and the effect will be displayed as shown in the figure: plug-in. Just agree to it. Restart When plug-in, you will automatically be prompted to download theFile - Settins - Plugins -, and install Flutter - install in , find FlutterDartas
Insert image description here
Insert image description here

The red mark in the picture meansDartThe plug-in installation is complete
Insert image description here
Insert image description here

ConfigurationFlutter and DartPath
Open settings in Android Studio Languages & Frameworks can see two more options: Flutter and Dart, follow Just configure your own Flutter and Dart paths as shown below:

3. Create a Flutter small project

Insert image description here
Insert image description here
Insert image description here

Insert image description here

Insert image description here
Insert image description here
Provide simplified code:

import 'package:flutter/material.dart';

void main() {
    
    
  return runApp(const Root());
}

class Root extends StatelessWidget {
    
    
  const Root({
    
    Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    
    
    return MaterialApp(
      title: "daylight",
      home: Scaffold(
        appBar: AppBar(title: const Text("daylight")),
        body: const Center(
          child: Text("hello world"),
        ),
      ),
    );
  }
}

The effect of running the program is as shown below:

Guess you like

Origin blog.csdn.net/qq_35091074/article/details/134951853