Here I used the logger library in order to add improvements to the code and ease of use
Features
1- It contains special methods to work with the Dio library
2- It contains a special method to handle a shared_preferences library
3- It contains several printing functions
4- It contains a function to print each level into a separate file
Getting started
Just create an instance of Logger and start logging:
var logger = Logger();