skip to Main Content

I am trying to post a JSON to our api but keep getting this error even if all values are NULL and are allowed to be NULL, here is the code snippet that causes the issue.

   final response = await http.post(Uri.parse('http://"api"/api/createPin'),
    body: json.encode({

      'location': Null,
      'description': Null,
      'qrcode': Null,
      'ttl': Null,
      'tier': Null,
      'type': Null,
      'user': Null,
      'images': Null,
      'viewable_users': Null
    }),
    );

ive searched forums and also a few videos but none solved my problem and I do not know what im doing wrong.

2

Answers


  1. How about changing from Null to null?

    Login or Signup to reply.
  2. You are looking for ‘null’ and not ‘Null’.

    Null is a class which cannot be instantiated and null a value.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search