[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: type 'int' is not a subtype of type 'double'
E/flutter (27556): #0 new Rating.fromJson (package:flutter_fake_api/model/model.dart:52:17)
E/flutter (27556): #1 ProductService.fetchProducts.<anonymous closure> (package:flutter_fake_api/services/service.dart:25:24)
E/flutter (27556): #2 MappedListIterable.elementAt (dart:_internal/iterable.dart:425:31)
E/flutter (27556): #3 ListIterator.moveNext (dart:_internal/iterable.dart:354:26)
E/flutter (27556): #4 new _GrowableList._ofEfficientLengthIterable (dart:core-patch/growable_array.dart:189:27)
E/flutter (27556): #5 new _GrowableList.of (dart:core-patch/growable_array.dart:150:28)
E/flutter (27556): #6 new List.of (dart:core-patch/array_patch.dart:39:18)
E/flutter (27556): #7 ListIterable.toList (dart:_internal/iterable.dart:224:7)
E/flutter (27556): #8 ProductService.fetchProducts (package:flutter_fake_api/services/service.dart:27:8)
E/flutter (27556): <asynchronous suspension>
output should be in container which contain title, image, price category, description ,rating
when call from api
2
Answers
Your Rating class like this :
Change Rating class like this :
double to int
if this is not working then check api response and parameters datatype.