작성
·
1.1K
0
import 'package:flutter/material.dart';
class TabPage extends StatefulWidget {
const TabPage({super.key});
@override
State<TabPage> createState() => _TabPageState();
}
class _TabPageState extends State<TabPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
bottomNavigationBar: BottomNavigationBar(
items: const [
BottomNavigationBarItem(icon: Icon(Icons.home), label: 'Home'),
],
),
);
}
}
이 부분에서 코드를 작성한 후 실행하면
======== Exception caught by widgets library =======================================================
The following assertion was thrown building TabPage(dirty, state: _TabPageState#63dc1):
'package:flutter/src/material/bottom_navigation_bar.dart': Failed assertion: line 246 pos 15: 'items.length >= 2': is not true.
The relevant error-causing widget was:
TabPage TabPage:file:///C:/Users/user/StudioProjects/instagram/lib/main.dart:21:19
When the exception was thrown, this was the stack:
#2 new BottomNavigationBar (package:flutter/src/material/bottom_navigation_bar.dart:246:15)
#3 TabPageState.build (package:instagram/tab/tabpage.dart:14:28)
#4 StatefulElement.build (package:flutter/src/widgets/framework.dart:5409:27)
#5 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:5297:15)
#6 StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:5462:11)
#7 Element.rebuild (package:flutter/src/widgets/framework.dart:5016:7)
#8 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:5279:5)
#9 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:5453:11)
#10 ComponentElement.mount (package:flutter/src/widgets/framework.dart:5273:5)
... Normal element mounting (220 frames)
#230 Element.inflateWidget (package:flutter/src/widgets/framework.dart:4182:16)
#231 MultiChildRenderObjectElement.inflateWidget (package:flutter/src/widgets/framework.dart:6569:36)
#232 MultiChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:6581:32)
... Normal element mounting (467 frames)
#699 Element.inflateWidget (package:flutter/src/widgets/framework.dart:4182:16)
#700 Element.updateChild (package:flutter/src/widgets/framework.dart:3707:18)
#701 RenderObjectToWidgetElement._rebuild (package:flutter/src/widgets/binding.dart:1253:16)
#702 RenderObjectToWidgetElement.mount (package:flutter/src/widgets/binding.dart:1222:5)
#703 RenderObjectToWidgetAdapter.attachToRenderTree.<anonymous closure> (package:flutter/src/widgets/binding.dart:1169:18)
#704 BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2719:19)
#705 RenderObjectToWidgetAdapter.attachToRenderTree (package:flutter/src/widgets/binding.dart:1168:13)
#706 WidgetsBinding.attachRootWidget (package:flutter/src/widgets/binding.dart:1001:7)
#707 WidgetsBinding.scheduleAttachRootWidget.<anonymous closure> (package:flutter/src/widgets/binding.dart:981:7)
#711 RawReceivePort.handleMessage (dart:isolate-patch/isolate_patch.dart:189:12)
(elided 5 frames from class AssertionError, class Timer, and dart:async-patch)
====================================================================================================
D/ProfileInstaller(12980): Installing profile for com.example.instagram
이런 에러가 계속 발생하는데 어떤 식으로 해결해야 할까요??