I have an app which shows data that comes from a API, but I'm having a problem, when the api isnt loaded yet the app is showing a error (because the list is empty and there is no data to show).
RangeError (index): Invalid value: Valid value range is empty: 0
Here is how i initiate the List at the top of the class:
List produtosList1 = <ProdutoOs>[];
Here is how i show the data:
child: Text(
produtosList1[index].data,
style: TextStyle(fontWeight: FontWeight.bold),
),
Is there a way to change the "produtosList1[index].data" to a specific string when the List is empty?