This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Run this code snippet in dartPad | |
void main() { | |
// Example of creating Singletons in dart & Use of mixins. | |
// Singleton creates only one instance/object. | |
// Hence less memory allocation. | |
//Below we have created two instances but its initialised only once. | |
ApiService service1 = ApiService.instance; | |
ApiService service2 = ApiService.instance; |