Dart List — Code Snippets Part 1

This article will give you the most important Code Snippets. The full documentation can be found from 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:

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:



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

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store