import 'package:flutter/material.dart';

void main() {
  runApp(
    MaterialApp(
      home: MyWidget(),
    ),
  );
}

class MyWidget extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    List<Widget> widgets = text(5);
    List<Widget> nullWidgets = text(0);
    return Scaffold(
      body: Center(
        child: Column(children: [...?nullWidgets ,Text("List of created "), ...widgets] )
      ),
    );
  }
}


List<Widget> text(int widgetNumber){
  List<Widget> createdTexts = <Widget>[];
  for(int i = 1 ; i <= widgetNumber ; i++){
    createdTexts.add(Text("Number $i"));
    
  }
  return createdTexts;
  

}
View Compiled
Run Pen

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.