mmvergara / supadart

Typesafe queries in Supabase Flutter! Generate Flutter / Dart 🎯 classes from your Supabase schema.
https://supadart.vercel.app
MIT License
43 stars 5 forks source link

Error when parsing "numeric" in generated code #64

Closed Achraf-cyber closed 2 months ago

Achraf-cyber commented 2 months ago

When I run supadart on a column with type numeric. I get

      col:
          json['col'] != null ? num.tryParse(json['col'].toString()) : 0,

The expression evalute to an "num?" rather than a "num" and cause a error when the col is not nullable. This error can be manually solved by replacing the "tryParse" method with a "parse" method or refactoring to use the null assignment operator

mmvergara commented 2 months ago

@Achraf-cyber thanks for opening an issue, will apply the proposed solution in the patch

mmvergara commented 2 months ago

@Achraf-cyber, the CLI has been updated. Please check if it's working correctly. I'd appreciate your feedback!

Achraf-cyber commented 2 months ago

Yes. It is working correctly thank you