is there any way i can implement an if statement inside a subtitle in ListTile? i can put it directly inside a widget but not in title/subtitle
ListTile(
title: Text("Location"),
subtitle: if (_currentPosition != null) Text(_currentAddress),
trailing: IconButton(...),
),
this gives an error "Expected an identifier. dart(missing_identifier)"
You have to do it like this:
subtitle: _currentPosition == null?
Text('No position found') //code if above statement is true
:Text(_currentAddress), //code if above statement is false