How does Flutter use third-party controls

1. The warehouse

All packages will be published in the Dat package repository, similar to the Java Jar package

pub.dev/

Third party library sorted by favorite star rating

Pub. Dev/flutter/pac…

2. Add the name and version under pubspec.yaml

dependencies:
  flutter:
    sdk: flutter

  cupertino_icons: ^1.0. 0
  fluttertoast: ^3.13.
  http: ^0.12. 0+1
  dio: ^2.014.
  url_launcher: ^4.2. 0+3
Copy the code

Click 4 Pub Outdated to view version information for third-party libraries

3. Import the third-party control package to the DART

import 'package:url_launcher/url_launcher.dart';

4. Use the URL to open Baidu

Launch (URL) This method must import the URL package to use.

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

class UrlPackageExample extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: "Using the third package example",
      home: new Scaffold(
        appBar: new AppBar(
          title: new Text("Examples of using third-party packages"),
        ),
        body: new Center(
          child: new RaisedButton(
            onPressed: () {
              const url = "https://www.baidu.com/";
              launch(url);
            },
            child: new Text("Open Baidu"(), ((), ((), ((), ((), (() }}Copy the code