{

# Dart| Flutter How to: Insert an element at beginning of a List with Example This tutorial shows how to insert the data at beginning of a list with examples in dart

`List` inserts the elements in the insertion order. In the below program, add method inserts the elements to the end of a List.

``````void main() {
List wordsList = ['one', 'two', 'three'];
print(wordsList);
}
``````

Output:

``````[one, two, three, five]
``````

## Dart List insert at the beginning with examples

The `List` insert method provides inserting an element at the index position. with this method, It increases the size of the list and the list must be growable.

``````void insert(int index, dynamic element)
``````
``````void main() {
List wordsList = ['one', 'two', 'three'];
wordsList.insert(0,"five");
print(wordsList);
}
``````

Output:

``````[five, one, two, three]
``````

Similarly, you can add at the start of a list using another way using for-in loop syntax.

``````void main() {
List wordsList = ['one', 'two', 'three'];
wordsList = [
"five",
for (String item in wordsList) item,
];
print(wordsList);
}
``````

Output:

``````[five, one, two, three]
``````
Join 6,000 subscribers and get a daily digest of full stack tutorials delivered to your inbox directly.No spam ever. Unsubscribe any time.

Similar Posts
Subscribe
You'll get a notification every time a post gets published here.

Related posts
{"ft_lang_label":"__label__en","ft_lang_prob":0.6980219,"math_prob":0.55934006,"size":1404,"snap":"2023-14-2023-23","text_gpt3_token_len":337,"char_repetition_ratio":0.13071428,"word_repetition_ratio":0.09417041,"special_character_ratio":0.2542735,"punctuation_ratio":0.18772563,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9520257,"pos_list":[0,1,2],"im_url_duplicate_count":[null,null,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2023-06-01T22:25:40Z\",\"WARC-Record-ID\":\"<urn:uuid:160840fa-af3c-441c-97a1-14f9cd9df329>\",\"Content-Length\":\"63061\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:11bcb934-a002-4437-aafd-b3d02fcaca18>\",\"WARC-Concurrent-To\":\"<urn:uuid:6d64abd5-1f6b-413d-a176-0055017d2353>\",\"WARC-IP-Address\":\"104.21.60.125\",\"WARC-Target-URI\":\"https://www.cloudhadoop.com/dart-list-insert-at-start/\",\"WARC-Payload-Digest\":\"sha1:SYFRKHSS2CIYXU2IDKPILEGXJGT4QNVV\",\"WARC-Block-Digest\":\"sha1:4FMWVG2BF2ZE3JUIQA6TIM5FLH6VEHSA\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2023/CC-MAIN-2023-23/CC-MAIN-2023-23_segments_1685224648209.30_warc_CC-MAIN-20230601211701-20230602001701-00605.warc.gz\"}"}