title: Save Bookmark Article in Firebase Flutter
body: <p>In  Flutter app I want to fetch data list<br>
  I want to save bookmark any article from article list in Fire store data base but when bookmark button tapped the same article save in the database every time. I want that article should save in database for the first time 
    Does anyone lead me to the correct way? Any help is highly appreciated! 
  My code</p>
  
  <pre><code> import 'package:flutter/material.dart';
  import 'package:cloud_firestore/cloud_firestore.dart';
  void main() =&gt; runApp( MyHomePage());
  
  class MyHomePage extends StatefulWidget {
    @override
    _MyHomePage createState() =&gt; _MyHomePage();
  }
  
  class _MyHomePage extends State&lt;MyHomePage&gt; {
    String title;
    String subtitle;
    int id;
    Firestore firestore = Firestore.instance;
    DocumentSnapshot document;
    @override
    Widget build(BuildContext context) {
      return Scaffold(
          appBar: AppBar(
            title: Text('jdj'),
          ),
          body: Container(
            child: ListView(
              children: &lt;Widget&gt;[
                stremBuilder(),
                Container(
                  height: 310,
                  color: Colors.amber,
                )
              ],
            ),
          ));
    }
  
    Widget stremBuilder() {
      return Container(
        height: 200,
        child: StreamBuilder(
          stream: Firestore.instance.collection("User").snapshots(),
          builder: (context, snapshot) {
            if (!snapshot.hasData)
              return Center(
                child: Text("Loding"),
              );
            return ListView.builder(
              itemCount: snapshot.data.documents.length,
              itemBuilder: (context, index) {
                return listItem(context, snapshot.data.documents[index]);
              },
            );
          },
        ),
      );
    }
  
    Widget listItem(BuildContext context, DocumentSnapshot document) {
      return ListTile(
        title: Text(document["title"]),
        subtitle: Text(document["subtitle"]),
        trailing: GestureDetector(
            child: Icon(Icons.bookmark),
            onTap: () {
              setState(() {
                saveData(id, document);
              });
            }),
      );
    }
  
    Map&lt;String, dynamic&gt; savedata = {};
    saveData(int id, DocumentSnapshot document) {
      Map&lt;String, dynamic&gt; savedata = {
        "id": id,
        "saveTitle": document["title"],
        'saveSubtitle': document["subtitle"]
      };
      Firestore.instance.collection("savedata").add(savedata);
    }
  }
  </code></pre>