//flutter import 'package:flutter/material.dart'; void main() { return runApp(TestPage()); } //リスト4.26 class TestPage extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( title: 'ListView', home: Scaffold( appBar: AppBar(title: Text('ListView')), body: HogeListWidget() ) ); } } class HogeListWidget extends StatefulWidget { @override State<HogeListWidget> createState() => _HogeListWidgetState(); } class _HogeListWidgetState extends State<HogeListWidget> { final itemList = List.generate(500, (i) => 'Item$i'); @override Widget build(BuildContext context) { return ListView.builder( itemCount: itemList.length, itemBuilder: (context, index) { return Text(itemList[index]); } ); } }