Created with <3 with dartpad.dev.
Last active
September 21, 2022 15:00
-
-
Save Chralu/550e9382b5bce2ba93a2343f91e14fcc to your computer and use it in GitHub Desktop.
Flutter101 - Class static property
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
class Logger { | |
static Logger instance = Logger(); | |
static void debug(String message) => instance.log( | |
level: "DEBUG", | |
message: message, | |
); | |
static void info(String message) => instance.log( | |
level: "INFO", | |
message: message, | |
); | |
void log({ | |
required String level, | |
required String message, | |
}) { | |
print("[$level]\t$message"); | |
} | |
} | |
void main() { | |
Logger.debug("Voici un message de debuggage."); | |
Logger.info("Et voila un message d'information."); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment