i am trying to use a json into another json but getting this error " Unhandled Exception: type '_InternalLinkedHashMap' is not a subtype of type 'Map'"
i am using jsonserializable this is my data file i want to use it in product file
import 'package:json_annotation/json_annotation.dart';
part 'data.g.dart';
@JsonSerializable()
class Data {
final String name;
final String price;
Data(this.name, this.price);
factory Data.fromJson(Map<String, dynamic> json) => _$DataFromJson(json);
Map<String, dynamic> toJson() => _$DataToJson(this);
}
productmodel file
import 'package:doorstep/domain/model/data.dart';
import 'package:json_annotation/json_annotation.dart';
part 'product-model.g.dart';
@JsonSerializable()
class ProductModel {
final String id;
final String title;
final String image;
final bool isLast;
final bool icon;
final List<Data> data;
ProductModel(
this.id, this.title, this.image, this.isLast, this.icon, this.data);
factory ProductModel.fromJson(Map<String, dynamic> json) =>
_$ProductModelFromJson(json);
Map<String, dynamic> toJson() => _$ProductModelToJson(this);
}
getting error in the productmodel file : " Unhandled Exception: type '_InternalLinkedHashMap' is not a subtype of type 'Map'"