_TypeError (type 'List<dynamic>' is not a subtype of type 'Map<String, dynamic>')

11,110 views
Skip to first unread message

Honson Luma

unread,
Jan 30, 2021, 2:18:53 PM1/30/21
to Flutter Development (flutter-dev)
Hello all,

I'm using woocommerce rest api to login customers ect. but I am getting this error: _TypeError (type 'List<dynamic>' is not a subtype of type 'Map<String, dynamic>')

The Code is:
LoginResponseModel.fromJson(Map<Stringdynamic> json) {
    success = json['success'];
    statusCode = json['statusCode'];
    code = json['code'];
    message = json['message'];
    data = json['data'] != null ? new Data.fromJson(json['data']) : null; 

error was in data = json['data'] != null ? new Data.fromJson(json['data']) : null; 

please help thanks

Suzuki Tomohiro

unread,
Jan 30, 2021, 2:22:28 PM1/30/21
to Flutter Development (flutter-dev)
What is the the content of the JSON response?

--
You received this message because you are subscribed to the Google Groups "Flutter Development (flutter-dev)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/flutter-dev/CA%2BxH8v_Dzfc%2BoKoREcoNgatf6%2BBoDdQka7JQwvRs9ie%3DNcau3Q%40mail.gmail.com.

Honson Luma

unread,
Jan 30, 2021, 3:30:22 PM1/30/21
to Suzuki Tomohiro, Flutter Development (flutter-dev)

Suzuki Tomohiro

unread,
Jan 30, 2021, 3:51:30 PM1/30/21
to Honson Luma, Flutter Development (flutter-dev)
Very close. Show me the content of the “json” variable.

Honson Luma

unread,
Jan 30, 2021, 4:10:18 PM1/30/21
to Suzuki Tomohiro, Flutter Development (flutter-dev)


I'm not sure what I'm looking for but here
But I am using a Word press plugin to config Json here is the link to the plugin - https://wordpress.org/plugins/jwt-auth/

I hope this helps a little bit



    // Use IntelliSense to learn about possible attributes.

    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version""0.2.0",
    "configurations": [
        {
            "name""semaiah_com",
            "request""launch",
            "type""dart"
        }
    ]

Suzuki Tomohiro

unread,
Jan 30, 2021, 4:23:21 PM1/30/21
to Honson Luma, Flutter Development (flutter-dev)
Set a breakpoint at line 21. Once the debugger stops there, show me the content of the “json” variable.

Honson Luma

unread,
Jan 30, 2021, 5:06:23 PM1/30/21
to Suzuki Tomohiro, Flutter Development (flutter-dev)
Ok, will do that.  I took a break from the computer. Later tonight I'll work on it and let you know. Thank you so much for you assistance
Reply all
Reply to author
Forward
0 new messages