1

I m using parse_server_sdk_flutter 3.0.0 to use parse server (back4app) in my app. I created custom class of ParseObject, when I m creating an instance of that custom object I m getting the above mentioned (In the title) error. I think it's because of null safety and I know that this version of package doesn't support null safety. Is there any other way to solve custom parse object creating or initializing ?

I m creating custom object as below !

class MyObject extends ParseObject implements ParseCloneable {

  MyObject() : super('MyObject'); //Getting error here !
  MyObject.clone(): this();

  @override clone(Map map) => MyObject.clone()..fromJson(map);
}

Registration part

await Parse().initialize(
        keyApplicationId,
        keyParseServerUrl,
        clientKey: keyParseClientKey,
        debug: true,
        liveQueryUrl: keyLiveQueryUrl,
        autoSendSessionId: true,
        registeredSubClassMap: <String, ParseObjectConstructor>{
     'MyObject': () => MyObject(),
   },
    );

Initialization Part

MyObject object = MyObject();

Naveen Avidi
  • 3,004
  • 1
  • 11
  • 23
  • Have you registered the custom class either in the initialization or using the registerSubClass function? More details in here: https://github.com/parse-community/Parse-SDK-Flutter/tree/master/packages/dart#custom-objects – Davi Macêdo May 31 '21 at 15:52
  • I registered in the initialization part ! – Naveen Avidi Jun 01 '21 at 06:47
  • And also when using QueryBuilder on that custom object, it gives the same error ! Ex: QueryBuilder builder = QueryBuilder(MyObject()); – Naveen Avidi Jun 01 '21 at 11:28
  • Would you mind to share the code that you used to initialize and register? – Davi Macêdo Jun 01 '21 at 16:57
  • Code Updated bro ! – Naveen Avidi Jun 02 '21 at 04:22
  • So the error happens when you do `MyObject object = MyObject();` right? Could you please double check if this code is actually running after the initialization code? – Davi Macêdo Jun 02 '21 at 17:27
  • Thank you so much bro ! This is the mistake ! I m using before it ! – Naveen Avidi Jun 03 '21 at 14:20
  • Hey bro ! One more question, I have a column in database a type of JSONArray which data looks like [{'name':'ABC','available':false},{'name':'MNO','available':true},other data...] and I want to query the values if values does not contains available:true ? How can I do this ? – Naveen Avidi Jun 04 '21 at 04:37
  • Would you mind to open a new question and share what you've tried so far? – Davi Macêdo Jun 04 '21 at 15:26

0 Answers0