monarch_utils 1.1.0 copy "monarch_utils: ^1.1.0" to clipboard
monarch_utils: ^1.1.0 copied to clipboard

Utilities for the monarch package. Monarch is a tool for building Flutter widgets in isolation. It makes it easy to build, test and debug complex UIs.

example/example.dart

import 'package:monarch_utils/log.dart';
import 'package:monarch_utils/log_config.dart';

final mainLogger = Logger('main');

void main() {
  // write log entries using `print` function, which prints to the console
  final subscription =
      writeLogEntryStream(print, printLoggerName: true, printTimestamp: true);

  sum(3, 5);
  sum(7, 11);

  final calculation = Calculation(13, 17);
  calculation.multipy();

  subscription.cancel();
}

int sum(int a, int b) {
  // log using a logger object
  final logger = Logger('sum');
  logger.fine('adding $a + $b');
  return a + b;
}

// you can also log using a mixin
class Calculation with Log {
  final int a;
  final int b;

  Calculation(this.a, this.b);

  int multipy() {
    log.info('multiplying $a * $b');
    return a * b;
  }
}
2
likes
160
pub points
49%
popularity

Publisher

verified publishermonarchapp.io

Utilities for the monarch package. Monarch is a tool for building Flutter widgets in isolation. It makes it easy to build, test and debug complex UIs.

Homepage
Repository (GitHub)
View/report issues
Contributing

Documentation

Documentation
API reference

License

MIT (license)

More

Packages that depend on monarch_utils