类型 'String' 不是 'index' 的 'int' 类型的子类型 probleme pour recuperer des donnees


======== Exception caught by widgets library =======================================================
The following _TypeError was thrown building HomePage(dirty, dependencies: [MediaQuery, _LocalizationsScope-[GlobalKey#cfe3e]], state: _HomePageState#0cc63):
type 'String' is not a subtype of type 'int' of 'index'
The relevant error-causing widget was: 
HomePage HomePage:file:///C:/Users/NadjiBiSenegal20/app_pompe/lib/loginPage.dart:299:56
When the exception was thrown, this was the stack: 
#0      _HomePageState.build (package:app_pompe/HomePage.dart:283:79)
#1      StatefulElement.build (package:flutter/src/widgets/framework.dart:4870:27)
#2      ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4754:15)
#3      StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:4928:11)
#4      Element.rebuild (package:flutter/src/widgets/framework.dart:4477:5)
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
HomePage.fromBase64(
resp['accessToken'],infosUser, infosLanguage)));
Container(
child: Padding(
padding: const EdgeInsets.only(
top: 8.0, bottom: 8.0),
child: SizedBox(
child: Text(
"${widget.infosUser['address']['address']}, ${widget.infosUser['address']['city']['name']}, ${widget.infosUser['address']['city']['region']['name']},",
style: TextStyle(
color:
GlobalVariable.appColor,
fontSize: _size / 80,
fontWeight:
FontWeight.bold),
textAlign: TextAlign.right),
),
),
),

我不确定,因为你没有提供调查这一点的所有信息,但我猜问题出在这一行:

fontSize: _size / 80,

你确定_size是一个数字吗?如果没有,则使用:

fontSize: _size.toInt() / 80,

最新更新