icecream 0.1.3

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

<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();
}

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

with Flutter:


$ flutter packages get

Alternatively, your editor might support pub get or packages 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

Analysis

We analyzed this package on Apr 23, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0-dev.49.0
  • pana: 0.10.6

Scores

Popularity:
Describes how popular the package is relative to other packages. [more]
0 / 100
Health:
Code health derived from static analysis. [more]
67 / 100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
98 / 100
Overall score:
Weighted score of the above. [more]
40
Learn more about scoring.

Platforms

Detected platforms: Flutter, other

Primary library: package:icecream/icecream.dart with components: io.

Suggestions

  • Fix analysis and formatting issues.

    Analysis or formatting checks reported 4 errors 5 hints.

    Strong-mode analysis of lib/src/ic_debugger.dart failed with the following error:

    line: 50 col: 62
    The method 'lightBlue' isn't defined for the class 'Colorize'.

    Strong-mode analysis of lib/src/content_parser.dart gave the following hint:

    line: 19 col: 28
    'onError' is deprecated and shouldn't be used.

  • The description is too short.

    Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

  • Package is pre-v1 release.

    While there is nothing inherently wrong with versions of 0.*.*, it usually means that the author is still experimenting with the general direction API.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.8.0 <2.0.0
colorize 0.1.2 0.1.2
inspect ^0.0.1 0.0.1
Transitive dependencies
path 1.5.1
Dev dependencies
test >=0.12.20 <0.13.0