lexicographic_int 1.0.0

Lexicographically-sortable encoding of integer numbers based on this paper by Peter Seymour.

Usage #

A simple usage example:

import 'package:lexicographic_int/lexicographic_int.dart';

main() {
  String bigNumber1 = '61241643';
  String bigNumber2 = '17568876414';
  String encNumber1 = encode(bigNumber1);
  String encNumber2 = encode(bigNumber2);
  print(encNumber1); // ^^861241643
  print(encNumber2); // ^^^21117568876414

  String encNumber3 = '^^3157';
  String encNumber4 = '--743';
  print(decode(encNumber3)); // '157'
  print(decode(encNumber4)); // '-67'
}

1.0.0 #

  • Initial version, encode and decode lexicographically sortable integers.

example/lexicographic_int_example.dart

import 'package:lexicographic_int/lexicographic_int.dart';

main() {
  String bigNumber1 = '61241643';
  String bigNumber2 = '17568876414';
  String encNumber1 = encode(bigNumber1);
  String encNumber2 = encode(bigNumber2);
  print(encNumber1); // ^^861241643
  print(encNumber2); // ^^^21117568876414

  String encNumber3 = '^^3157';
  String encNumber4 = '--743';
  print(decode(encNumber3)); // '157'
  print(decode(encNumber4)); // '-67'
}

Use this package as a library

1. Depend on it

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


dependencies:
  lexicographic_int: ^1.0.0

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

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

3. Import it

Now in your Dart code, you can use:


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

We analyzed this package on Aug 16, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.4.0
  • pana: 0.12.19

Platforms

Detected platforms: Flutter, web, other

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

Maintenance suggestions

The package description is too short. (-5 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.2.0 <3.0.0
Dev dependencies
pedantic ^1.0.0
test ^1.0.0