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

> Gerencie as contas de redes sociais dos seus usuários pelo Flutter usando o pacote Ayrshare Flutter SDK

## Visão Geral

O [Flutter](https://flutter.dev) é o kit de UI do Google para criar aplicativos bonitos e compilados nativamente para mobile, web e desktop a partir de uma única base de código.

O pacote Ayrshare Flutter SDK permite integrar a API de redes sociais da Ayrshare aos seus apps Flutter.

## Instalação

Instale o pacote como uma biblioteca no seu app.

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

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

## Exemplo de Uso para Publicação

Este app de exemplo cria um botão que chama a função post. Ele publica uma citação aleatória e uma imagem aleatória nas contas Twitter e Facebook vinculadas. Ele imprime a resposta que inclui as URLs dos posts ao vivo nas redes sociais.

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

## Mais Informações e Documentação

<ul class="custom-bullets">
  <li>
    Abra a página de vinculação (generateJWT) no [iOS com
    Flutter](/apis/profiles/generate-jwt#mobile-jwt-examples).
  </li>

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