0
votes

I'm still a bit new to Flutter / Dart I recover the data from php json file but it displays an error in flutter.

E/flutter ( 7160): [ERROR:flutter/lib/ui/ui_dart_state.cc(166)] Unhandled Exception: 
NoSuchMethodError: Class '_InternalLinkedHashMap<String, dynamic>' has no instance method 'cast' with 
matching arguments.
E/flutter ( 7160): Receiver: _LinkedHashMap len:1
E/flutter ( 7160): Tried calling: cast<Map<String, dynamic>>()
E/flutter ( 7160): Found: cast<RK, RV>() => Map<RK, RV>
E/flutter ( 7160): #0      Object.noSuchMethod (dart:core-patch/object_patch.dart:51:5)
1
Check the stack trace and find out which line is causing the issue and post it. - Benjamin
error at this ligne : final items = json.decode(response.body).cast<Map<String, dynamic>>(); - salma

1 Answers

1
votes

Try final items = Map<String, dynamic>.from(json.decode(response.body));