I have a field called images in a class:
final images = ["amusement1.jpeg", "amusement2.jpg", "amusement3.png", "amusement4.jpeg",
"amusement5.jpeg", "amusement6.jpeg"];
And I want to set the default value of another field:
var displayImage = images[0];
But this gives the error:
lib/main.dart:46:22: Error: Can't access 'this' in a field initializer to read 'images'.
var displayImage = images[0];
^^^^^^
Performing hot restart... 40ms
How to initialize a value of a field in Dart?