*Error: The operator '<' isn't defined for the class 'Object'.
- 'Object' is from 'dart:core'. Try correcting the operator to an existing operator, or defining a '<' operator.
title: Text((snapshot.hasData&&snapshot.data !<10)? "${snapshot.data}":'Demo'),
CodePudding user response:
You have to indicate what type the snapshot is, you can do that by indicating it in <>
at the StreamBuilder
, like
StreamBuilder<int>(
Also note that even though
snapshot.hasData&&snapshot.data !<10
works, it's highly unconventional and you should space it like
snapshot.hasData && snapshot.data! < 10
CodePudding user response:
if you want to check the length of number of data, it is snapshot.data!.docs().length < 10
if its the text value of data,
var data = snapshot.data!.doc() as Map<String, dynamic>;
int.tryParse(data['<data_field_for_validation>']) < 10