Reputation: 37
I am trying to call the following hideOverlay function from a separate class
hideOverlay() {
overlayEntry?.remove();
overlayEntry = null;
if (overlayEntry != null) {
overlayEntry.remove();
overlayEntry = null;
}
}
In a separate class, I have imported the file containing the function and attempted to call the file by using.
hideOverlay();
I am a super newbie please advise what I am doing wrong :-(
Upvotes: 0
Views: 76
Reputation: 1210
Put hideOverlay() as a method in a Class, lets call that class 'FirstClass' and from a separate class call an object of the FirstClass class and call that hideOverlay() method like this.
import 'first_class.dart';
class SecondClass {
FirstClass firstClass;
//call function like this when needed.
firstClass.hiveOverlay()
}
Upvotes: 1