title: How can to write array in firestore where I use the flutter?
body: <p>How can to write array in firestore where I use the flutter?</p>
  <p>In my project, I need modity to write array data in firestore when user post the images.</p>
  <p>this is my code.</p>
  <pre><code>void postImage(
      String uid,
      String username,
      String userImage,
      String profImage,
      String blue_check,
    ) async {
      setState(() {
        _isLoading = true;
      });
  
  try {
          String res = await FirestoreMethods().uploadPost(
            _descriptionController.text,
            _file!,
            uid,
            username,
            profImage,
            blue_check,
          );
  }
  </code></pre>
  <p>then it's will call</p>
  <pre><code>Future&lt;String&gt; uploadPost(
      String description,
      Uint8List file,
      String uid,
      String username,
      String profImage,
      String blue_check,
    ) async {
      String res = &quot;Some error occurred&quot;;
      try {
        String photoUrl =
            await StroageMethods().uploadImageToStroage('Posts', file, true);
        String postid = _firestore.collection('Posts').doc().id;
        Post post = Post(
          Lat: currentPostionLatitude,
          Lng: currentPostionLongitude,
          blue_check: blue_check,
          country: &quot;Australia&quot;,
          description: description,
          imageType: &quot;image&quot;,
          location: '',
          postImages: photoUrl,
          postid: postid,
          postimage: photoUrl,
          profile_image: profImage,
          publisher: publisher,
          sub: getSub,
          time: DateTime.now(),
          title: '',
          type: type,
          username: username,
          view: 0,
          like: [],
        );
        _firestore.collection('Posts').doc(postid).set(
              post.toJson(),
            );
        res = &quot;Successful&quot;;
        print(post);
      }
  </code></pre>
  <p>then I add the new mutilimage function</p>
  <pre><code>Center(
          child: InkWell(
            onTap: () async {
              final ImagePicker _picker = ImagePicker();
              final List&lt;XFile&gt;? images = await _picker.pickMultiImage();
              if (images != null) {
                productBloc.add(onSelectMultipleImageEvent(images));
              }
            },
            child: Container(
              alignment: Alignment.center,
              margin: EdgeInsets.symmetric(horizontal: 20),
              height: 150,
              decoration: BoxDecoration(
                color: Colors.grey[200],
                borderRadius: BorderRadius.circular(12.0),
              ),
              child: BlocBuilder&lt;ProductBloc, ProductState&gt;(
                builder: (context, state) =&gt; state.images != null
                    ? ListView.builder(
                        scrollDirection: Axis.horizontal,
                        padding: EdgeInsets.symmetric(vertical: 5),
                        itemCount: state.images!.length,
                        itemBuilder: (_, i) =&gt; Container(
                              height: 100,
                              width: 120,
                              margin: EdgeInsets.only(left: 3.0, right: 3.0),
                              decoration: BoxDecoration(
                                  image: DecorationImage(
                                image: FileImage(File(state.images![i].path)),
                                fit: BoxFit.cover,
                              )),
                            ))
                    : Icon(
                        Icons.photo_camera,
                        size: 80,
                        color: Colors.grey,
                      ),
              ),
            ),
          ),
        ),
  </code></pre>
  <p>I hope when user select the image then it can write array data in firestore. so the <code>postImages: photoUrl,</code> need to change array. How can get the data then write into <code>postImages: photoUrl,</code> ??</p>