flutter loop widget code example
Example 1: flutter for loop
final children = <Widget>[];
for (var i = 0; i < 10; i++) {
children.add(new ListTile());
}
return new ListView(
children: children,
);
Example 2: flutter stateful widget
class YellowBird extends StatefulWidget {
const YellowBird({ Key key }) : super(key: key);
@override
_YellowBirdState createState() => _YellowBirdState();
}
class _YellowBirdState extends State<YellowBird> {
@override
Widget build(BuildContext context) {
return Container(color: const Color(0xFFFFE306));
}
}
Example 3: make stateful widget flutter
class MyClass extends StatefulWidget {
@override
MyClassState createState() => new MyClassState();
}
class MyClassState extends State<MyClass> {
}
Example 4: Flutter For In loop explained
Math
Biology
Economic
History
Science