Flutter: How to check if a variable is a List<Object?>?

Viewed 123

Code:

print(item);
print(item.runtimeType);
print(item.runtimeType is List);
print(item.runtimeType is List<Object?>);

Result:

flutter: [null, null]
flutter: List<Object?>
flutter: false
flutter: false

I don't know how to get a true for this check...

2 Answers

try this out, and try to tinker with this code:

var firstList = [1,2,3,4,5,6]; print(firstList.firstWhere((i) => i < 4));

Related