Mo711
Mo711

Reputation: 639

Get the number of Items in a List

Is there a way in dart to count and get the number of items in a List? So, when you have a list with five words in it, it would output you the number five, when the method is called?

Upvotes: 0

Views: 3357

Answers (2)

Tadas Petra
Tadas Petra

Reputation: 428

You just take your list variable and do .length on it to return how long it is.

https://api.dart.dev/stable/2.8.2/dart-core/List-class.html

Upvotes: 1

Mithil Poojary
Mithil Poojary

Reputation: 301

list_variable_name.length

Reference: Tutorialspoint

Upvotes: 4

Related Questions