Issue
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
Solution
please try with this
if(json['subscription'] !=null) { subscription = Subscription.fromJson(json['subscription']); }
Answered By – Mohammad Faizan
Answer Checked By – Marilyn (FlutterFixes Volunteer)