You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import 'package:floor/floor.dart';
@Entity(tableName: 'EventN') // Use @Entity instead of @entity
class EventN {
@PrimaryKey(autoGenerate: true)
final int? id;
final DateTime date;
final String description;
final String category;
final String subCategory;
final String mdp;
final double? amount;
final String type;
final String mdpType;
final String? mdpName;
EventN({this.id, required this.date, required this.description, required this.category, required this.amount, required this.type, required this.subCategory,required this.mdp, required this.mdpType, this.mdpName });
}
And a EventDao:
import 'package:floor/floor.dart';
import '../entity/event.dart';
@dao
abstract class EventDao {
@Query('SELECT * FROM EventN')
Stream<List<EventN>> findAllEvent();
@Query('SELECT (SUM(CASE WHEN type = \'entrata\' THEN amount ELSE 0 END) - '
'SUM(CASE WHEN type = \'uscita\' THEN amount ELSE 0 END)) AS net_result '
'FROM EventN')
Stream<double?> calculateNetResult();
@insert
Future<void> insertEventN(EventN event);
}
The problem is that when my table is empty, my query of calculate net_result gives error as Unhandled Exception: type 'Null' is not a subtype of type 'double' in type cast
I shouldn't use databaseview in this case because it's a single result query right?
The text was updated successfully, but these errors were encountered:
Hi.
I have a Event Entity:
And a EventDao:
The problem is that when my table is empty, my query of calculate net_result gives error as Unhandled Exception: type 'Null' is not a subtype of type 'double' in type cast
I shouldn't use databaseview in this case because it's a single result query right?
The text was updated successfully, but these errors were encountered: