Skip to content

Instantly share code, notes, and snippets.

@Chralu
Last active September 21, 2022 15:00
Show Gist options
  • Save Chralu/550e9382b5bce2ba93a2343f91e14fcc to your computer and use it in GitHub Desktop.
Save Chralu/550e9382b5bce2ba93a2343f91e14fcc to your computer and use it in GitHub Desktop.
Flutter101 - Class static property

Flutter101 - Class static property

Created with <3 with dartpad.dev.

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