Dart List — Code Snippets Part 1

Achsuthan Mahendran
3 min readMay 17, 2021


This article will give you the most important List Code Snippets. The full documentation can be found from api.flutter.dev website.

What is List in Dart?

An indexable collection of objects with a length is called List.

Dart List having commonly have two different type kinds.

  1. Fixed length — The Dart will give you an error when you try to change the length of the list.
  2. Dynamic length (growable length)

Okay. Lets jump in to the code snipits.


  1. List.empty({bool growable: false})

2. List.filled(int length, E fill, {bool growable: false})

3. List.from(Iterable elements, {bool growable: true})

4. List.generate(int length, E generator(int index), {bool growable: true})

5. List.unmodifiable(Iterable elements)


  1. first

2. isEmpty

3. last

4. reversed

5. length


I hope this article will help you to quickly understand and get to know about constructors and the properties of List. The Part 2 will contain the methods of List. Once the Part 2 get published this article will be updated soon.

This Code Snippets can be found from GitHub: https://github.com/Achsuthan/FlutterCodeSnippets/tree/main/DartList

Thanks for reading this article. Please leave claps if you find it useful! And I will be happy to hear any feedback.

Follow me on LinkedIn: www.linkedin.com/in/achsuthanmahendran



Achsuthan Mahendran

iOS Developer, Web Developer, Flutter Developer. GitHub: achsuthan