lzstring 1.0.1+2

  • Readme
  • Changelog
  • Example
  • Installing
  • 84

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


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)}');
      '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:

  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';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Jan 25, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.0
  • pana: 0.13.4

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.


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