icecream 0.1.3

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 0

<center>IceCreamDart</center>

icecream

iceream for Dart is a flavor of a good tasting debugger #

It is a library inspired by the python icecream library

The purpose is to to make debugging over the console easy again.

Instead of print() or window.console.log(), ic helps to make developing much sweeter.

icecream without Arguments #

Ic comes in handy to determine which part of code is being executed and where. So if no arguments are passed to ic, it prints out the filem, line and the parent function it is being executed in.

ic() without arguments is synchronous

import 'package:icecream/icecream.dart' show ic;

void foo() {
  ic();
}

void main() {
  ic();

  foo();
}

Output:

🍦  example.dart:8 in main()
🍦  example.dart:4 in foo()

icecream with arguments #

ic with arguments inspects them and return its arguments with the returning value

Be aware due to some IO, ic() with arguments is async and therefore should be awaited to ensure the right printing order


import 'package:icecream/icecream.dart' show ic;

num bar(num x, num y) {
  return x + y;
}

void main() async {
  await ic(bar(1, 2));
}

Output:

🍦  bar(1, 2): 3

Returning ic value #

ic returns its value async while the output will still be printed out


import 'package:icecream/icecream.dart' show ic;

void main() async {
  var output = await ic("Hello");
}

Disable ic #


import 'package:icecream/icecream.dart' show ic;

void main() {
  await ic();
  await ic.disable();
  await ic();
  await ic.enable();
  await ic();
}

Output:

🍦  example.dart:4 in main()
🍦  example.dart:8 in main()

Custom prefix #

import 'package:icecream/icecream.dart' show ic;

void main() {
  await ic.setPrefix("ic| ");
  await ic(3);
}

Output:

ic | 3: 3

Installation #

Insert in your pubspec.yaml:

dependencies:
  icecream: '0.1.3'

In command line:

pub get

Or let your IDE/Editor do the work

Warning: #

This library depends on the dart:mirror core library and is therefore only usable in a standalone VM of Dart.

TODO: #

  1. Extensive testing
  2. Proper documentation
  3. Provide all icecream flavors with a juicy icon
  4. Provide own configuration for flexible use of ic

Change Log #

Pub version 0.1.3 #

+ Β΄ic()Β΄ without arguments now is colored
+ Disable stderr output programaticaly
+ Set custom prefix for output
+ Updating of README.md according to changes and awareness of async

example/example.dart

import 'package:icecream/icecream.dart' show ic;

num bar(num x, num y) {
  return x + y;
}

main() async {
  await ic();
  await ic.disable();
  await ic();
  await ic.enable();
  await ic();

  await simpleExample();
  await diaableIc();
  await changePrefix();
}

changePrefix() async {
  await ic.setPrefix("ic |");
  await ic(3);
}

simpleExample() async {
  await ic(3);
  await ic(bar(1, 2));
}

diaableIc() async {
  await ic();
  await ic.disable();
  await ic();
  await ic.enable();
  await ic();
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  icecream: ^0.1.3

2. Install it

You can install packages from the command line:

with pub:


$ pub get

Alternatively, your editor might support pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:icecream/icecream.dart';
  
Version Uploaded Documentation Archive
0.1.3 Apr 16, 2018 Go to the documentation of icecream 0.1.3 Download icecream 0.1.3 archive
0.1.2 Apr 13, 2018 Go to the documentation of icecream 0.1.2 Download icecream 0.1.2 archive
0.1.1 Apr 13, 2018 Go to the documentation of icecream 0.1.1 Download icecream 0.1.1 archive
0.1.0 Apr 13, 2018 Go to the documentation of icecream 0.1.0 Download icecream 0.1.0 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
--
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
--
Overall:
Weighted score of the above. [more]
0
Learn more about scoring.

The package version is not analyzed, because it does not support Dart 2. Until this is resolved, the package will receive a health and maintenance score of 0.

Analysis issues and suggestions

Support Dart 2 in pubspec.yaml.

The SDK constraint in pubspec.yaml doesn't allow the Dart 2.0.0 release. For information about upgrading it to be Dart 2 compatible, please see https://www.dartlang.org/dart-2#migration.

Maintenance issues and suggestions

Make sure dartdoc successfully runs on your package's source files. (-10 points)

Dependencies were not resolved.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.8.0 <2.0.0