> ## Documentation Index
> Fetch the complete documentation index at: https://www.ayrshare.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Flutter

> Quản lý các tài khoản mạng xã hội của người dùng từ Flutter bằng cách sử dụng gói SDK Flutter Ayrshare

## Tổng quan

[Flutter](https://flutter.dev) là bộ công cụ UI của Google để xây dựng các ứng dụng đẹp, được biên dịch nguyên bản cho di động, web và máy tính để bàn từ một cơ sở mã duy nhất.

Gói SDK Flutter Ayrshare cho phép bạn tích hợp API mạng xã hội của Ayrshare với các ứng dụng Flutter của mình.

## Cài đặt

Cài đặt gói dưới dạng thư viện trong ứng dụng của bạn.

```shell theme={"system"}
 $ flutter pub add ayrshare_flutter
```

<Card title="Gói Flutter Ayrshare" icon="flutter" href="https://pub.dev/packages/ayrshare_flutter" horizontal>
  Gói SDK Flutter Ayrshare
</Card>

## Ví dụ sử dụng Đăng bài

Ứng dụng mẫu này tạo một nút gọi hàm post. Nó đăng một câu trích dẫn ngẫu nhiên và một hình ảnh ngẫu nhiên lên các tài khoản Twitter và Facebook đã được liên kết. Nó in phản hồi bao gồm các URL cho các bài đăng trực tiếp trên các mạng xã hội.

```dart theme={"system"}
import 'package:flutter/material.dart';
import 'ayrshare_flutter.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: PostingPage(),
    );
  }
}

class PostingPage extends StatelessWidget {
  ///TODO get your API key by signing up at ayrshare.com
  final apiKey = '###-###-###-###';

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      // appBar: null,
        body: Center(
          child: ElevatedButton(
            onPressed: () async {
              await post(
                apiKey: apiKey,
                body: {
                  'randomPost': true,
                  'platforms': ['twitter', 'facebook'],
                  'randomMediaUrl': true
                },
              ).then((value) => print(value));
            },
            child: const Text('Post To Social'),
          ),
        ));
  }
}
```

## Thông tin và Tài liệu Bổ sung

<ul class="custom-bullets">
  <li>
    Khởi chạy trang liên kết (generateJWT) trên [iOS với
    Flutter](/apis/profiles/generate-jwt#mobile-jwt-examples).
  </li>

  <li>[Kho lưu trữ Github](https://github.com/ayrshare/ayrshare_flutter)</li>
  <li>[Nhật ký thay đổi](https://pub.dev/packages/ayrshare_flutter/changelog)</li>
</ul>
