Home > OS >  Calling other method of class, not only simple parent/children relation
Calling other method of class, not only simple parent/children relation

Time:06-21

When I call the children class from parent class I can use GlobalObjectKey

and when I call the parent method from chidlren class I can use callback

This two can work when structure is simple.

However when there are more complex structure.

such as

  • calling method from parents of parents of brother.

  • calling method from children of children of brother.

  • calling method which dosen't have relevant.

Is there any good method for this purpose??

CodePudding user response:

Not sure if this is a good method but you can create a dart file with method written globally (not inside a class). These methods can be accessed by any class by just importing the dart file and variables inside this dart file persists throught the session too.

  • Related