Skip to content

Unhandled Exception: type 'Null' is not a subtype of type 'int' #670

Closed
@hemanthkb97

Description

@hemanthkb97

New Issue Checklist

Issue Description

Im getting error when i try to save object

Steps to reproduce

savefollow() async {
    ParseUser? currentuser = await ParseUser.currentUser();
    if (currentuser != null) {
      if (isprivate) {
      } else {
        QueryBuilder<ParseUser> follows =
            QueryBuilder<ParseUser>(ParseUser.forQuery());
        follows.whereEqualTo("username", username);
        var res = await follows.query();
        if (res.success) {
          ParseUser followsuser = res.results!.first;
          ParseObject followsave = ParseObject("Follow");
          followsave.set("user", currentuser);
          followsave.set("follows", followsuser);
          followsave.set("status", "following");
          var response = await followsave.save();
        }
      }
    }
  }

Actual Outcome

I/flutter (11081): ╭-- Parse Request
I/flutter (11081): curl -X GET -H 'user-agent: Flutter Parse SDK 3.1.0' -H 'X-Parse-Application-Id: ' -H 'X-Parse-Session-Token: ' -H 'X-Parse-Client-Key: ' https://parseapi.back4app.com/classes/_User?where=%7B%22username%22:%20%22jathin%22%7D
I/flutter (11081):
I/flutter (11081): https://parseapi.back4app.com/classes/_User?where={"username": "jathin"}
I/flutter (11081): ╰--
I/flutter (11081): ╭-- Parse Response
I/flutter (11081): Class: _User
I/flutter (11081): Function: ParseApiRQ.query
I/flutter (11081): Status Code: 200
I/flutter (11081): Payload: [{"className":"_User","objectId":"ptkI67Y2TP","createdAt":"2021-08-14T06:42:49.752Z","updatedAt":"2021-08-14T06:44:07.324Z","username":"jathin","your":[],"verified":false,"private":false,"about":"Nothing here","emailVerified":true,"anonymoususername":true,"fullname":"Jathin","dob":"29/7/1996","gender":"man","publicdata":{"__type":"Pointer","className":"Userpublicdata","objectId":"qdXw3h7L0G"},"ACL":{"*":{"read":true,"write":false},"ptkI67Y2TP":{"read":true,"write":true}}}]
I/flutter (11081): ╰--
I/flutter (11081):
I/flutter (11081): ╭-- Parse Request
I/flutter (11081): curl -X POST -H 'content-type: text/plain; charset=utf-8' -H 'user-agent: Flutter Parse SDK 3.1.0' -H 'X-Parse-Application-Id: ' -H 'X-Parse-Session-Token: r:f3b9ded81a9875bf4eb3f60e124b04c5' -H 'X-Parse-Client-Key: ' -d '{"requests":[{"method":"PUT","path":"/classes/_User/ptkI67Y2TP","body":{"username":"jathin"}}]}' https://parseapi.back4app.com/batch
I/flutter (11081):
I/flutter (11081): https://parseapi.back4app.com/batch
I/flutter (11081): ╰--
E/flutter (11081): [ERROR:flutter/lib/ui/ui_dart_state.cc(199)] Unhandled Exception: type 'Null' is not a subtype of type 'int'
E/flutter (11081): #0 _ParseResponseBuilder._handleSuccess
E/flutter (11081): #1 _ParseResponseBuilder.handleResponse
E/flutter (11081): #2 handleResponse
E/flutter (11081): #3 batchRequest
E/flutter (11081):
E/flutter (11081): #4 ParseObject._saveChildren
E/flutter (11081):
E/flutter (11081): #5 ParseObject.save
E/flutter (11081):
E/flutter (11081): #6 _NOprofileState.savefollow
E/flutter (11081):
E/flutter (11081):

Expected Outcome

Pull Request

  • 🤩 I submitted a PR with a fix.

Environment

Parse Flutter SDK

  • SDK version: 3.1.0
  • Operating system: windows 11
  • Operating system version: FILL_THIS_OUT

Server

  • Parse Server version: FILL_THIS_OUT
  • Operating system: FILL_THIS_OUT
  • Local or remote host (AWS, Azure, Google Cloud, Heroku, Digital Ocean, etc): b4a

Database

  • System (MongoDB or Postgres): MongoDB
  • Database version: FILL_THIS_OUT
  • Local or remote host (MongoDB Atlas, mLab, AWS, Azure, Google Cloud, etc): b4a

Logs

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions