Answers for "how to run function inside the classdart"

0

how to run function inside the classdart

class Animals
{
  var animalList = ['dog','cat','cow'];

  // function for printing the list of animals

  void animalListPrinter(){
    for(var animal in animalList){
        print(animal);

     }
  }
}
Posted by: Guest on May-21-2021
0

how to run function inside the classdart

class ShowingAnimalList extends StatelessWidget {
     final Animals ani= new Animals();
     @override
     Widget build(BuildContext context) {
       return GestureDetector(
         onTap: ani.animalListPrinter(),
       );
  }
}
Posted by: Guest on May-21-2021

Code answers related to "how to run function inside the classdart"

Browse Popular Code Answers by Language