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

> Manage your users' social media accounts from Flutter using the Ayrshare Flutter SDK package

## Overview

[Flutter](https://flutter.dev) is Google's UI toolkit for building beautiful, natively compiled applications for mobile, web, and desktop from a single codebase.

The Ayrshare Flutter SDK package allows you to integrate Ayrshare's social media API with your Flutter apps.

## Installing

Install the package as a library in your app.

```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 package
</Card>

## Usage Example of Posting

This sample app creates a button which calls the post function. It posts a random quote and a random image to the linked Twitter and Facebook accounts. It prints the response which includes the URLs for the live posts on the social networks.

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

## More Information and Documentation

<ul class="custom-bullets">
  <li>
    Launch the linking page (generateJWT) on [iOS with
    Flutter](/apis/profiles/generate-jwt#mobile-jwt-examples).
  </li>

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