Skip to content

Instantly share code, notes, and snippets.

@googlicius
Last active May 5, 2019 18:43
Show Gist options
  • Select an option

  • Save googlicius/91d699ceda3fc7ca8e5b6d9c29457171 to your computer and use it in GitHub Desktop.

Select an option

Save googlicius/91d699ceda3fc7ca8e5b6d9c29457171 to your computer and use it in GitHub Desktop.

Revisions

  1. googlicius renamed this gist May 5, 2019. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. googlicius renamed this gist May 5, 2019. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  3. googlicius revised this gist May 5, 2019. No changes.
  4. googlicius revised this gist May 5, 2019. 1 changed file with 30 additions and 1 deletion.
    31 changes: 30 additions & 1 deletion main.dart
    Original file line number Diff line number Diff line change
    @@ -1 +1,30 @@
    // Main
    class Logger {
    final String name;
    bool mute = false;

    static final Map<String, Logger> _cache = <String, Logger>{};

    factory Logger(String name) {
    if(_cache.containsKey(name)) {
    return _cache[name];
    }
    else {
    final logger = Logger._internal(name);
    _cache[name] = logger;
    return logger;
    }
    }

    Logger._internal(this.name);

    void log(String msg) {
    if(!mute) {
    print(msg);
    }
    }
    }

    main() {
    var logger = Logger('UI');
    logger.log('Button clicked');
    }
  5. googlicius created this gist May 5, 2019.
    1 change: 1 addition & 0 deletions main.dart
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    // Main