ilkersevim_safe_parse 0.1.4 copy "ilkersevim_safe_parse: ^0.1.4" to clipboard
ilkersevim_safe_parse: ^0.1.4 copied to clipboard

Convert dynamic and JSON-like values into typed Dart values without crashes, using predictable null and fallback behavior.

ilkersevim_safe_parse #

Safe parsing helpers for dynamic / JSON-like values. Dependency-free beyond the Dart SDK (dart:developer for parse failure logs).

Why use this package? #

  • Replace repeated type checks in repositories, mappers, caches, and snapshot readers with shared conversion rules.
  • Tolerate missing or unexpected values through predictable null and fallback results.
  • Parse common scalar and collection shapes without coupling code to Flutter or a serialization framework.

License: Apache-2.0. Issues: github.com/redjadet/ilkersevim_safe_parse/issues.

Installation #

dependencies:
  ilkersevim_safe_parse: ^0.1.1

Requires Dart >=3.12.0.

Usage #

import 'package:ilkersevim_safe_parse/ilkersevim_safe_parse.dart';

final String? name = stringFromDynamic(json['name']);
final int? count = intFromDynamic(json['count']);
final Map<String, dynamic>? map = mapFromDynamic(raw);

mapFromDynamic returns null when the value is not a map or when any key is not a String (it never throws).

API #

  • stringFromDynamic / stringFromDynamicTrimmed
  • intFromDynamic / doubleFromDynamic / boolFromDynamic
  • mapFromDynamic / listFromDynamic
  • parseMapOfMaps
1
likes
160
points
389
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Convert dynamic and JSON-like values into typed Dart values without crashes, using predictable null and fallback behavior.

Repository (GitHub)
View/report issues

Topics

#json #parsing #dart

License

Apache-2.0 (license)

More

Packages that depend on ilkersevim_safe_parse