flutter

Call back function from one class to another

class Class1Name{
    Class2Name(functionName: functionName);

    void functionName(){
        //desired actions
    }
}

class Class2Name {
    final VoidCallback functionName;
    Class2Name({@required this.functionName});

    //call function
    functionName();
}

https://www.digitalocean.com/community/tutorials/flutter-widget-communication
Was this helpful?