title: How to play a list of videos stored in your assets folder referenced as an array using video player plugin
body: <pre><code>import 'package:video_player/video_player.dart';
  import 'package:flutter/material.dart';
  
  void main() =&gt; runApp(VideoApp());
  
  class VideoApp extends StatefulWidget {
    @override
    _VideoAppState createState() =&gt; _VideoAppState();
  }
  
  class _VideoAppState extends State&lt;VideoApp&gt; {
    var vidlist = [
      'assets/videos/1.mp4',
      'assets/videos/2.m4',
      'assets/videos/3.mp4'
    ];
    VideoPlayerController _controller;
    bool _isPlaying = false;
  
    @override
    void initState() {
      super.initState();
      _controller = VideoPlayerController.asset(vidlist)
        ..addListener(() {
          final bool isPlaying = _controller.value.isPlaying;
          if (isPlaying != _isPlaying) {
            setState(() {
              _isPlaying = isPlaying;
            });
          }
        })
        ..initialize().then((_) {
          // Ensure the first frame is shown after the video is initialized, even before the play button has been pressed.
          setState(() {});
        });
    }
  
    @override
    Widget build(BuildContext context) {
      return MaterialApp(
        title: 'Video Demo',
        home: Scaffold(
          body: Center(
            child: _controller.value.initialized
                ? AspectRatio(
                    aspectRatio: _controller.value.aspectRatio,
                    child: VideoPlayer(_controller),
                  )
                : Container(),
          ),
          floatingActionButton: FloatingActionButton(
            onPressed: _controller.value.isPlaying
                ? _controller.pause
                : _controller.play,
            child: Icon(
              _controller.value.isPlaying ? Icons.pause : Icons.play_arrow,
            ),
          ),
        ),
      );
    }
  }
  </code></pre>
  
  <p>This is what I have done.I tried to make an array of Strings referencing the paths to the videos.  However, the video player controller cannot accept list types. So then how does one play a list of videos stored locally? I also tried using a for loop in the controller but it doesn't work.</p>