Error is shown when subscription object is null which is the required type parameter.
Error: NoSuchMethodError: The method '[]' was called on null. Receiver: null Tried calling:
How to solve this error, arrived on when subscription object is null.
I also shared my model class download link https://drive.google.com/file/d/1gcOKQ49RaEF3w0NBPpijGtbGUdSkgZrx/view?usp=sharing
CodePudding user response:
please try with this
if(json['subscription'] !=null) { subscription = Subscription.fromJson(json['subscription']); }