Nowadays, stories, like on Instagram, widely uses in apps for displaying news, educational content, and interactions with users.


I created a new plugin that allows implementing full story functionality with only few lines of code.



Thanks for the Flutter open community, I found out a nice plugin story_view (thanks for the creator of this plugin) and, based on this plugin, created a new one with grouped stories and some new features.

The new plugin flutter_instagram_stories is on active development, and you can ask feature requests or add an issue on Github.


Create an app with stories


For the date of publication, the plugin works only with the Firebase (Firestore) database. In case it is needed, I will implement data receiving from any API.


  1. Add the package to your app


    dependencies:
    flutter_instagram_stories: ^0.0.1+1

  2. Now in your Dart code, you can use


    import 'package:flutter_instagram_stories/flutter_instagram_stories.dart';

  3. Add Firebase database to your app
    Android
    iOS


  4. Create a Firestore database with data
    Create a collection with any name. After you will use this name in dart code only once.
    Create documents inside the collection with exact structure, like on the image below
    It MUST be the same because this data uses for models inside the plugin.



image


You can use any URLs for images, video files, gifs.


That’s it! Now your app has Instagram stories with caching and other powerful features.


A full example, with the open database, you can find here.


Plugin on pub.dev — flutter_instagram_stories.


Example in the real app


This plugin uses for implementing stories in Lifext.app


Guys made really nice design and I recommend to take a look:


> Android
> iOS