convertx 0.1.4

Dart native js
Flutter Android iOS web

Static extension methods for converting between different data representations.

convertx #

Dart CI codecov pub package dart>=2.6

Static extension methods for converting between different data representations.

Getting started #

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

dependencies:
  convertx: ^0.1.4

Then import the following, so you can use the extensions:

import 'package:convertx/convertx.dart';

Overview #

Convertx exposes the most common dart:convert functionalities.

base64: #

final base64String = 'Hello World!'.toUtf8ByteList().toBase64String();
print(base64String); // SGVsbG8gV29ybGQh

final originalString = base64String.toBase64ByteList().toUtf8String();
print(originalString); // Hello World!

JSON: #

final jsonString = {'answer': 42}.toJsonString();
print(jsonString); // {"answer":42}

final originalMap = jsonString.toDecodedJson() as Map;
print(originalMap); // {answer: 42}

Escape HTML: #

final html = '<strong>Romeo & Juliet</strong>'.escapeHtml();
print(html); // &lt;strong&gt;Romeo &amp; Juliet&lt;&#47;strong&gt;

Common string codecs: #

// ASCII
print('Hello World!'.toAsciiByteList().toAsciiString()); // Hello World!

// Latin1
print('¡Hola Mundo!'.toLatin1ByteList().toLatin1String()); // ¡Hola Mundo!

// UTF-8
print('你好,世界!'.toUtf8ByteList().toUtf8String()); // 你好,世界!

Contribute #

To report a bug or request any feature, please create an issue.

0
likes
110
pub points
28%
popularity

Publisher

parsodyl.com

Static extension methods for converting between different data representations.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD (LICENSE)

More

Packages that depend on convertx