简体   繁体   English

未处理的异常:类型 '_InternalLinkedHashMap<string, dynamic> ' 不是类型 'String' 的子类型</string,>

[英]Unhandled Exception: type '_InternalLinkedHashMap<String, dynamic>' is not a subtype of type 'String'

I'm getting this error我收到这个错误

2023-01-04 15:05:33.297 15984-16060/com.example.food_app E/flutter: [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: type '_InternalLinkedHashMap<String, dynamic>' is not a subtype of type 'String'
    #0      PopularProductController.getPopularProductList (package:food_app/controllers/popular_product_controller.dart:30:71)
    <asynchronous suspension>
    #1      _SplashScreenState._loadResource (package:food_app/pages/splash/splash_page.dart:25:5)
    <asynchronous suspension>

popular_product_controller.dart:30:71 popular_product_controller.dart:30:71

Future<void> getPopularProductList()async {
    Response response = await popularProductsRepo.getPopularProductList();
    if(response.statusCode==200) {
      _popularProductList =[];
      _popularProductList.addAll(Product.fromJson(jsonDecode(response.body)).products);
      _isloaded=true;
      update();
    }else{
    }
  }

package:food_app/pages/splash/splash_page.dart:25:5 package:food_app/pages/splash/splash_page.dart:25:5

Future<void>_loadResource() async {
    await Get.find<PopularProductController>().getPopularProductList();
    await Get.find<RecommendedProductController>().getRecommendedProductList();

  }

..................... ......................

Unhandled Exception: type '_InternalLinkedHashMap<String, dynamic>' is not a subtype of type 'String'

your output is not matching to model class, 1st check what you get from api after you able to fix this error您的 output 与 model 不匹配 class,在您能够修复此错误后,首先检查您从 api 获得的内容

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 颤振:未处理的异常:类型 &#39;_InternalLinkedHashMap<String, dynamic> &#39; 不是 &#39;String&#39; 类型的子类型 - Flutter: Unhandled Exception: type '_InternalLinkedHashMap<String, dynamic>' is not a subtype of type 'String' 未处理的异常:'_InternalLinkedHashMap<string, dynamic> ' 不是 'String' 类型的子类型? 在类型转换中</string,> - Unhandled Exception: '_InternalLinkedHashMap<String, dynamic>' is not a subtype of type 'String?' in type cast 未处理的异常:类型 &#39;_InternalLinkedHashMap<String, dynamic> &#39; 不是 &#39;String 类型的子类型 - Unhandled Exception: type '_InternalLinkedHashMap<String, dynamic>' is not a subtype of type 'String 未处理的异常:[type '_InternalLinkedHashMap<string, dynamic> ' 不是 'String' 类型的子类型]</string,> - Unhandled exception: [type '_InternalLinkedHashMap<String, dynamic>' is not a subtype of type 'String'] 未处理的异常:类型 '_InternalLinkedHashMap<string, dynamic> ' 不是类型 'String' 的子类型</string,> - Unhandled Exception: type '_InternalLinkedHashMap<String, dynamic>' is not a subtype of type 'String' 未处理的异常:键入&#39;_InternalLinkedHashMap <String, dynamic> &#39;不是&#39;Future类型的子类型 <dynamic> &#39; - Unhandled Exception: type '_InternalLinkedHashMap<String, dynamic>' is not a subtype of type 'Future<dynamic>' 未处理的异常:类型 &#39;_InternalLinkedHashMap<String, dynamic> &#39; 不是 &#39;Iterable 类型的子类型<dynamic> &#39; - Unhandled Exception: type '_InternalLinkedHashMap<String, dynamic>' is not a subtype of type 'Iterable<dynamic>' 未处理的异常:类型 '_InternalLinkedHashMap<string, dynamic> ' 不是类型 'List 的子类型<dynamic> '</dynamic></string,> - Unhandled Exception: type '_InternalLinkedHashMap<String, dynamic>' is not a subtype of type 'List<dynamic>' 未处理的异常:类型 '_InternalLinkedHashMap<string, dynamic> ' 不是类型的子类型</string,> - Unhandled Exception: type '_InternalLinkedHashMap<String, dynamic>' is not a subtype of type 未处理的异常:类型 '_InternalLinkedHashMap<string, dynamic> ' 不是类型 'Response' 的子类型</string,> - Unhandled Exception: type '_InternalLinkedHashMap<String, dynamic>' is not a subtype of type 'Response'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM