pinchbv / floor

The typesafe, reactive, and lightweight SQLite abstraction for your Flutter applications
https://pinchbv.github.io/floor/
Apache License 2.0
947 stars 190 forks source link

type missmatch int <-> double #828

Open EvsenevDev opened 3 months ago

EvsenevDev commented 3 months ago

I have model with these fields:

final double price;
final double tax;

@ColumnInfo(name: 'exchange_rate')
final double exchangeRate;

And these columns in database:

Screenshot 2024-05-20 at 10 58 08 PM

generated code: price: row['price'] as double

Issue: type 'int' is not a subtype of type 'double' in type cast

I'm guessing sometimes in mappper recognizes it as int sometimes as double.

Is it possible to map it as I need? Maybe converter where I can get Object? as input and map by myself? I've tried to use String converter, but it's using as String instead of toString() which works fine.

Any solution?