id 1.0.16

  • README.md
  • Installing
  • Versions
  • 66

Id

A library for consistently representing identifiers, usually in a code generation setting.

Build Status

Purpose

The purpose of the library is to have a standard way of generating an object, an Id, that can be used in any of a variety of casing contexts.

Examples

For example, suppose you are writing a code generator that has a need for a single id with multiple representations. The following representations are covered:

  • snake case: words are all lower case with underscores (how_now_brown_cow)
  • emacs: words are all lower with hyphens (how-now-brown-cow)
  • shout: words are all upper case with underscores (HOW_NOW_BROWN_COW)
  • camel: words are joined with each word capitalized excluding the first (howNowBrownCow)
  • capCamel: words are joined with all words capitalized (HowNowBrownCow)
  • title: All words capitalized and joined with spaces (How Now Brown Cow)
  • squish: Lower case with no hypens or underscores (hownowbrowncow)
  • abbrev: The abbreviation in lower case (hnbc)

The default constructor requires the identifier to be snake case:

var id = new Id('how_now_brown_cow');
print(id);                   // => howNowBrownCow        
print(id.snake);             // => how_now_brown_cow     
print(id.emacs);             // => how-now-brown-cow     
print(id.shout);             // => HOW_NOW_BROWN_COW     
print(id.camel);             // => howNowBrownCow        
print(id.capCamel);          // => HowNowBrownCow        
print(id.title);             // => How Now Brown Cow     
print(id.squish);            // => hownowbrowncow        
print(id.abbrev);            // => hnbc                  

An library function accepts either snake or any camel and returns a new Id:

var id = idFromString('testName');

1. Depend on it

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


dependencies:
  id: "^1.0.16"

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:id/id.dart';
        
Version Uploaded Documentation Archive
1.0.16 May 27, 2017 Go to the documentation of id 1.0.16 Download id 1.0.16 archive
1.0.15 Jun 8, 2016 Go to the documentation of id 1.0.15 Download id 1.0.15 archive
1.0.13 Feb 7, 2016 Go to the documentation of id 1.0.13 Download id 1.0.13 archive
1.0.12 Sep 5, 2015 Go to the documentation of id 1.0.12 Download id 1.0.12 archive
1.0.11 Aug 21, 2015 Go to the documentation of id 1.0.11 Download id 1.0.11 archive
1.0.10 May 20, 2015 Go to the documentation of id 1.0.10 Download id 1.0.10 archive
1.0.9 Apr 20, 2015 Go to the documentation of id 1.0.9 Download id 1.0.9 archive
1.0.8 Apr 12, 2015 Go to the documentation of id 1.0.8 Download id 1.0.8 archive
1.0.7 Apr 11, 2015 Go to the documentation of id 1.0.7 Download id 1.0.7 archive
1.0.6 Apr 3, 2015 Go to the documentation of id 1.0.6 Download id 1.0.6 archive

All 20 versions...

Analysis

This feature is new.
We welcome feedback.
More details: scoring.

We analyzed this package, and provided a score, details, and suggestions below.

  • tool failures on Feb 14, 2018
  • Dart: 2.0.0-dev.20.0
  • pana: 0.10.1

Scores

Popularity:
Describes how popular the package is relative to other packages. [more]
54 / 100
Health:
Code health derived from static analysis. [more]
79 / 100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
76 / 100
Overall score:
Weighted score of the above. [more]
66

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:id/id.dart.

Suggestions

  • Fix lib/id.dart.

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

    line: 23 col: 3
    Invalid override. The type of 'Id.==' ('(Id) → bool') isn't a subtype of 'Object.==' ('(dynamic) → bool').

  • Maintain CHANGELOG.md.

    Changelog entries help clients to follow the progress in your code.

  • Fix issues reported by dartanalyzer.

    dartanalyzer reported 1 error(s) and 0 warning(s).

  • 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.

  • Maintain an example.

    Create a short demo in the example/ directory to show how to use this package. Common file name patterns include: main.dart, example.dart or you could also use id.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.8.2 <2.0.0
collection ^1.1.0 1.14.5
logging >=0.9.3 <0.12.0 0.11.3+1
quiver >=0.21.0 <0.25.0 0.24.0 0.28.0
Transitive dependencies
matcher 0.12.1+4
path 1.5.1
stack_trace 1.9.2
Dev dependencies
ebisu ^0.7.4
test >=0.12.0 <0.14.0