Links

Flutter

Flutter Package for Ayrshare

Installing

Install the package as a library in your app.
$ flutter pub add ayrshare_flutter

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