Reputation: 3092
I want to do a simple conversion: Integer to String. Like this.
String select= (int.parse(widget.data['object']['element'])+1).toString();
But return this error
Unhandled Exception: type 'int' is not a subtype of type 'String'
Anybody know what is the error?
Upvotes: 0
Views: 1123
Reputation: 8229
Try this way
int data = int.parse(widget.data['object']['element'] + 1);
String select=data.toString();
Upvotes: 2
Reputation: 591
I think widget.data['object']['element'] value is already int.
Try
(widget.data['object']['element'] +1).toString();
Upvotes: 0