close

[Solved] type ‘List‘ is not a subtype of type ‘List‘ in Flutter

Hello Guys, How are you all ? Hope you all are fine. Today I have faced type ‘List’ is not a subtype of type ‘List’ this error where I Use in my Flutter Firebase Project.

I have Used Firestore Example in My Flutter Project. When I run my flutter app. But I get this error in my Console.

I am using This Below Code Where I Got Error.

I get this below error

Here I am Come with all Possible Solution. So let’s Start this tutorial without wasting your Time. Let’s start this article.

Solutions

The problem here is that type inference fails in an unexpected way. The solution is to provide a type argument to the map method.

Question: How to solve type ‘List<dynamic>’ is not a subtype of type ‘List<Widget>’ in flutter ?
Answer: Problem is that the type interface fails in an unexpected way. The solution is to provide an argument to the map method. Tryout below all solutions. It will definitely work for you.

Solution 1 : Provide type argument to the map method.

Problem is that type inference fails in an unexpected way. The solution is to provide a type argument to the map method.

For Example:

Because of map is followed by toList and because there is no way to type annotate the return of a closure.

This Solution Worked for me. hope it will also work for you.

Solution 2 :  Converting Map to Widget

Here I am solving this error by converting Map to Widget.

Solution 3 : Cast dynamic List to List With specific Type

We can Cast dynamic List to List With specific Type:

So Hope This Above 3 Solution Will Work For You Too. So it’s all About type ‘List’ is not a subtype of type ‘List’ in Flutter error. Hope this tutorial helped you a lot. Comment below Your thoughts and your queries. And Also Comment on your suggestion here.

Also Read

Milan Dhameliya is an Information Technology Engineer. By profession, he is a Full Stack developer with knowledge of multiple back-end platforms (e.g., PHP, Node.js, Python) and frontend Flutter frameworks.

Leave a Comment