LateInitializationError: Field '_instance@717240915' has not been initialized Error

832 views Asked by At

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();

0

There are 0 answers