flutter_ghost_content_api 0.0.1 copy "flutter_ghost_content_api: ^0.0.1" to clipboard
flutter_ghost_content_api: ^0.0.1 copied to clipboard

outdated

A Flutter wrapper around the Ghost Content API

Flutter Ghost Content API #

A flutter wrapper around the Ghost Content API.

Usage #

Firstly, create a new custom app integration in your Ghost publication and make a note of the content API key.

Next, create a GhostContentAPIProvider at the root of your Flutter application:

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return GhostContentAPIProvider(
      client: GhostContentAPIClient(
        version: 'v2',
        url: 'https://your-subdomain.ghost.io',
        contentAPIkey: 'your content api key',
      ),
      child: MaterialApp(
        title: 'Flutter Demo',       
        home: MyHomePage(),
      ),
    );
  }
}

Finally, use a FutureBuilder anywhere you would like to access your Ghost content:

class MyHomePage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("Flutter Ghost"),
      ),
      body: FutureBuilder(
        future: GhostContentAPIProvider.of(context).client.getPosts(),
        builder: (BuildContext context, AsyncSnapshot<PostsResponse> snapshot) {
          // Build your UI
        },
      ),
    );
  }
}

Example #

See my Flutter Ghost App for Learn Software.

Tests #

Run:

  • flutter packages get
  • flutter test
0
likes
0
pub points
0%
popularity

Publisher

unverified uploader

A Flutter wrapper around the Ghost Content API

Homepage

License

unknown (LICENSE)

Dependencies

flutter, http

More

Packages that depend on flutter_ghost_content_api