Get your
own
website
Change Orientation
Ctrl+Alt+O
Change Theme
Ctrl+Alt+D
Change Language
Go to Spaces
Ctrl+Alt+P
extension Scores on List
{ int get total { var sum = 0; for (var score in this) { sum += score; } return sum; } } void main() { var fruits = ['apple', 'banana']; print(fruits.total); }
main.dart:13:16: Error: The getter 'total' isn't defined for the type 'List<String>'.
- 'List' is from 'dart:core'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'total'.
print(fruits.total);
^^^^^