Home > front end >  RangeError (index) : invalid calue : not in incusive range 0..2:3
RangeError (index) : invalid calue : not in incusive range 0..2:3

Time:04-23

hey guys I'm trying to make an app that will track bitcoin prices in a sample way ... but it give me that error in the android-emulator but nothing in the code itself and I don't know what went wrong,

I think that the problem is in the DropdownMenuItem list but I can't get it

can anyone help, thanks

class PriceScreen extends StatefulWidget {
  @override
  _PriceScreenState createState() => _PriceScreenState();
}

class _PriceScreenState extends State<PriceScreen> {
  String selectedCurrency = 'EGP';
  List<DropdownMenuItem<String>> getDropdownItems() {
    List<DropdownMenuItem<String>> dropdownItems = [];

    for (int i = 0; i < currenciesList.length; i  ) {
      String currency = (cryptoList[i]);
      var newItem = DropdownMenuItem(
        child: Text(currency),
        value: currency,
      );
      dropdownItems.add(newItem);
    }
    return dropdownItems;
  }

  @override
  Widget build(BuildContext context) {
    getDropdownItems();
    return Scaffold(
      appBar: AppBar(
        title: Text('           
  • Related