【问题标题】:The argument type 'String' can't be assigned to the parameter type 'int' [closed]参数类型\'String\'不能分配给参数类型\'int\' [关闭]
【发布时间】:2022-10-12 22:35:55
【问题描述】:

参数类型“String”不能分配给参数类型“int”

【问题讨论】:

  • 分享您的代码以提供帮助
  • 对不起,我想删除这个问题但我不能这样做,我已经解决了这个问题

标签: android ios flutter dart geolocator


【解决方案1】:

如果我没记错的话,您将数据存储为 ArrayList<HashMap<Int,String>> 您正在尝试错误地检索数组的元素。您需要重新定义检索到的数据

【讨论】:

    【解决方案2】:

    您已将 allStores 定义为一个数组,因此当您要访问数组中的任何值时,请给出您想要从中获取值的索引的数组位置,请使用:

    Text( "${data.allstores[0]['distance'].round()} KM Away",),
    

    参数类型 'String' 不能分配给参数类型 'int' 因为你没有给出数组索引

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-11-06
      • 2021-10-02
      • 2020-06-21
      • 2021-10-06
      • 2020-04-15
      • 2020-12-03
      • 2021-06-19
      • 2021-08-19
      相关资源
      最近更新 更多