parse_functions 2.0.1 copy "parse_functions: ^2.0.1" to clipboard
parse_functions: ^2.0.1 copied to clipboard

Simple functions that can be used to parse values, most often from json.

example/example.dart

import 'package:parse_functions/parse_functions.dart';

Future<void> main() async {
  ///double parsing
  parseDouble(null, 2.0);

  ///int parsing
  parseInt(null, 2);

  ///num parsing
  parseNum(null, 2);

  ///String parsing
  parseString(null, 'test');

  ///bool parsing
  parseBool(null, defaultValue: true);

  ///DateTime parsing
  parseDateTime(null, DateTime(2000));

  ///UriData parsing
  final uriData = UriData.parse('data:,A%20brief%20note');
  parseUriData(null, uriData);

  ///Uri parsing
  final uri = Uri.parse('https://www.wikipedia.org');
  parseUri(null, uri);

  ///BigInt parsing
  final bigInt = BigInt.from(1000);
  parseBigInt(null, bigInt);

  ///List parsing
  parseList<String>(
    null,
    (value) => parseString(value, ''),
    defaultValue: ['test'],
  );

  ///ListNoCatch parsing
  parseListNoCatch<String>(
    null,
    (value) => parseString(value, ''),
    defaultValue: ['test'],
  );
}
0
likes
140
pub points
47%
popularity

Publisher

unverified uploader

Simple functions that can be used to parse values, most often from json.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (LICENSE)

More

Packages that depend on parse_functions