Example Using Provider So, first to get the String value created in the main. dart , all we have to do is call Provider. of< String>(context) , the of() method here will obtain the nearest Provider up its widget tree and returns its value.
Example Using Provider So, first to get the String value created in the main. dart , all we have to do is call Provider. of< String>(context) , the of() method here will obtain the nearest Provider up its widget tree and returns its value.