Skip to content

[ParseCloudFunction] Unhandled exception: type 'ParseObject' is not a subtype of type 'DietPlan' in type cast #28

Closed
@ghost

Description

Hello,

I created a Cloud Code Function which returns only one Diet_Plans object.

I execute this code :

function() async {
    var function = ParseCloudFunction('getOneDietPlan');
    var response = await function.execute();

    if (response.success) {
      print(ApplicationConstants.APP_NAME + ": " + (response.result as DietPlan).name);
    } else {
      print(ApplicationConstants.APP_NAME + ": " + response.error.message);
    }
  }

And there is an error with the print in the success condition, this is my console :

I/flutter (25760): ----
I/flutter (25760): Hello Flutter API Response (getOneDietPlan : ParseApiRQ.execute) :
I/flutter (25760): Status Code: 200
I/flutter (25760): Payload: Instance of 'ParseObject'
I/flutter (25760): ----
E/flutter (25760): [ERROR:flutter/shell/common/shell.cc(184)] Dart Error: Unhandled exception:
E/flutter (25760): type 'ParseObject' is not a subtype of type 'DietPlan' in type cast

And similar error when the cloud code function return multiple objects, there is an error like :

type 'ParseObject' is not a subtype of type 'Iterable<dynamic>' in type cast

In advance, thank you.

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