convert_object 1.1.0
convert_object: ^1.1.0 copied to clipboard
A comprehensive type conversion library for Dart with a fluent API, safe try* variants, robust Date/Number/URI parsing, enum helpers, and extensive collection/map/list extensions.
1.1.0 #
- Add
Map.tryGetRaw(key, {alternativeKeys}): returns the selected value with no type conversion, for polymorphic or unknown-typed fields. It preserves the raw value (no coercion, no decoding). alternativeKeysnow selects the first NON-NULL candidate across all map getters (getString/tryGetString/etc.). Previously it selected the first key that merely existed, so a present-but-null alternative key short-circuited the lookup.- This is a behavior change for the "present-but-null alternative key" edge case and affects every typed map getter that uses
alternativeKeys. - To distinguish an absent key from a key whose value is
null, useMap.containsKeydirectly; neithertryGetRawnor a??chain can express that distinction.
1.0.4 #
- Consolidate 1.0.0 changelog into organized sections for clarity.
- Update example with improved API usage demonstration.
- Fix markdown table formatting in test documentation.
1.0.3 #
- Align Converter fluent shortcuts with Convert optional arguments, including mapKey, listIndex, defaultValue, and formatting flags.
- Add Converter enum helpers and a named Converter.string to expose full string options.
- Add top level convertToEnum and tryConvertToEnum helpers.
- Allow enum extensions to forward debugInfo without losing key or index context.
1.0.2 #
- Add Kotlin-style scope helpers:
also,takeIf, andtakeUnless.
1.0.1 #
- Add Roman numeral helpers and conversions.
- Align SDK constraint to ^3.10.0 and update dev dependencies.
1.0.0 #
Initial stable release - A comprehensive, null-safe type-conversion toolkit for Dart & Flutter.
Core Features #
- Fluent
Convertfacade with static helpers and safetry*variants for all conversions. - Full primitive conversions: int, double, num, bool, String, DateTime, Duration, Uri.
- Collection helpers:
getInt,getString,getList,getMap, and more with safe defaults. - Enum utilities with
EnumParsers.fromStringand extension-based parsing. Converterwrapper for chained, null-safe access into nested maps and lists.
Configuration #
ConvertConfigfor global defaults: number/date formats, locales, boolean literals, URI policies.- Custom
TypeRegistryfor pluggable type parsers viaConvert.toType<T>. - Scoped overrides with
ConvertConfig.overrides(...)andrunScopedConfig. - Exception hooks (
onException) for centralized error handling.
JSON Toolkit #
jsonSafeandJsonOptionsfor normalizing Dart objects to JSON-compatible maps.- Strategies for enums, dates, durations, and binary data (base64 encoding).
- Options for dropping nulls, sorting keys, and cycle detection.
Error Handling #
ConversionExceptionwith preserved stack traces (Sentry-friendly).- Concise
toString()and JSON-safefullReport()for diagnostics.
Extras #
- Kotlin-style scope helpers:
also,takeIf,takeUnless. - Roman numeral conversions.
- DateFormat/NumberFormat caching for reduced allocations.