> ## 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

> Ayrshare Flutter SDKパッケージを使用して、Flutterからユーザーのソーシャルメディアアカウントを管理します

## 概要

[Flutter](https://flutter.dev)は、単一のコードベースからモバイル、Web、デスクトップ用の美しい、ネイティブコンパイル済みアプリケーションを構築するためのGoogleのUIツールキットです。

Ayrshare Flutter SDKパッケージを使用すると、AyrshareのソーシャルメディアAPIをFlutterアプリと統合できます。

## インストール

パッケージをアプリのライブラリとしてインストールします。

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

<Card title="Ayrshare Flutter Package" icon="flutter" href="https://pub.dev/packages/ayrshare_flutter" horizontal>
  Ayrshare Flutter SDKパッケージ
</Card>

## 投稿の使用例

このサンプルアプリは、投稿機能を呼び出すボタンを作成します。リンクされたTwitterとFacebookアカウントにランダムな引用とランダムな画像を投稿します。ソーシャルネットワーク上のライブ投稿のURLを含むレスポンスを出力します。

```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'),
          ),
        ));
  }
}
```

## その他の情報とドキュメント

<ul class="custom-bullets">
  <li>
    [iOS with Flutter](/apis/profiles/generate-jwt#mobile-jwt-examples)でリンクページ(generateJWT)を起動します。
  </li>

  <li>[Github Repository](https://github.com/ayrshare/ayrshare_flutter)</li>
  <li>[Changelog](https://pub.dev/packages/ayrshare_flutter/changelog)</li>
</ul>
