lzstring 1.0.1+2

lzstring_dart #

Dart implementation of lz-string compression algorithm

The original JavaScript version is here

Usage #

String compressedString = LZString.compress('Some String');
String decompressedString = LZString.decompress(compressedString);

For more usage, please read the exapmle in example folder

Running test #

pub run test test/lz_string.dart

1.0.1+2 #

  • Update document comments

1.0.1 #

  • Fix issue which makes non english characters cannot be decompress
  • Add document comments

1.0.0 #

  • Initial commit

example/main.dart

import 'package:lzstring/lzstring.dart';

void main() { 
  String input = "Dart implemntation of lz-string";
  print('Input: $input');
  print('Compressed String: ${LZString.compress(input)}');
  print('Compressed Base 64 String: ${LZString.compressToBase64(input)}');
  print('Compressed UTF16 String: ${LZString.compressToUTF16(input)}');
  print(
      'Compressed Encoded URI Component: ${LZString.compressToEncodedURIComponent(input)}');
  print('Compressed Uint8 Array: ${LZString.compressToUint8Array(input)}');
}

Use this package as a library

1. Depend on it

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


dependencies:
  lzstring: ^1.0.1+2

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:lzstring/lzstring.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
43
Health:
Code health derived from static analysis. [more]
98
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
71
Learn more about scoring.

We analyzed this package on Aug 21, 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:lzstring/lzstring.dart.

Health suggestions

Fix lib/lzstring.dart. (-1.99 points)

Analysis of lib/lzstring.dart reported 4 hints:

line 342 col 9: DO use curly braces for all flow control structures.

line 347 col 3: Prefer using /// for doc comments.

line 366 col 9: The value of the local variable 'next' isn't used.

line 499 col 11: DO use curly braces for all flow control structures.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.17.0 <3.0.0
typed_data ^1.0.0 1.1.6
Dev dependencies
test ^1.0.0