jetleaf_convert library Conversion
🔄 JetLeaf Convert
This is the umbrella library for JetLeaf’s type conversion framework. It provides access to all conversion utilities, services, and preconfigured converters for transforming data between types.
By importing this library, developers can perform conversions for primitives, collections, objects, time types, and custom types in a consistent and type-safe manner across JetLeaf applications.
🔑 Features
- Core conversion service for runtime type conversion.
- Predefined converters for Dart types, collections, maps, and objects.
- Utilities for managing conversion adapters and type pairs.
- Exception handling for conversion errors.
🎯 Intended Usage
import 'package:jetleaf_convert/jetleaf_convert.dart';
final result = DefaultConversionService().convert<String>(123);
print(result); // "123"
Provides a centralized entry point to all JetLeaf conversion features.
Classes
- ArrayListToCollectionGenericConverter
-
A converter that transforms an
ArrayListto a specific collection subtype. - BigDecimalGenericConverter
-
A converter that transforms a
BigDecimalto a specific numeric subtype. - BigIntegerGenericConverter
-
A converter that transforms a
BigIntegerto a specific numeric subtype. - BigIntGenericConverter
- A converter that transforms a BigInt to a specific numeric subtype.
- BooleanGenericConverter
-
A converter that transforms a
Booleanto a specific numeric subtype. - BoolGenericConverter
- A converter that transforms a bool to a specific numeric subtype.
- ByteMultiConverter
-
A Converter that converts between
Byte, String, List, and Uint8List. - CharacterGenericConverter
-
A converter that transforms a
Characterto a specific numeric subtype. - CollectionToCollectionConverter
- An abstract base class for converting between different types of Dart collections, with optional element type conversion.
- ConditionalConverter
- A contract for a converter that only matches under certain conditions.
- ConfigurableConversionService
- A configurable conversion service that allows dynamic registration of converters.
- ConversionAdapterUtils
-
Utility class for converting generic or adaptable collections into strongly
typed collections based on JetLeaf
Classmetadata. - ConversionService
- A strategy interface for type conversion.
-
ConversionServiceConverter<
S, T> - A Converter that delegates to a ConversionService for converting values.
- ConversionServiceFactory
- Utility class for registering a set of converters with a ConverterRegistry.
- ConversionUtils
- Utility class containing common operations used by conversion infrastructure.
-
Converter<
S, T> -
A generic interface for converting an input of type
Sinto an output of typeT. -
ConverterFactory<
S, R> -
A factory for creating Converter instances that convert from a source type
Sto a target typeT, whereTis a subtype ofR. - ConverterRegistry
- A registry of converters and converter factories used to perform type conversions at runtime.
- ConvertiblePair
- Represents a pair of source and target types for type conversion.
-
ConvertingComparator<
S, T> -
A comparator that compares source values of type
Sby first converting them to another typeTusing a Converter, then applying aComparatoronT. - CurrencyToStringConverter
-
A Converter that converts a
Currencyto a String. - DateTimeToIntConverter
- Converts DateTime to int (epoch milliseconds)
- DateTimeToLocalDateConverter
- Converts DateTime to LocalDate
- DateTimeToLocalDateTimeConverter
- Converts DateTime to LocalDateTime
- DateTimeToLocalTimeConverter
- Converts DateTime to LocalTime
- DateTimeToStringConverter
- Converts DateTime to String using ISO 8601 format
- DateTimeToZonedDateTimeConverter
- Converts DateTime to ZonedDateTime with specified zone
- DefaultConversionService
- A fully configured, ready-to-use conversion service suitable for most JetLeaf environments.
- DoubledGenericConverter
-
A converter that transforms a
Doubleto a specific numeric subtype. - DoubleGenericConverter
- A converter that transforms a double to a specific numeric subtype.
- DurationToIntConverter
- Converts Duration to int (milliseconds)
- DurationToStringConverter
- Converts Duration to String in readable format
- EnumToIntConverter
- A Converter that converts an Enum to an int.
- EnumToStringConverter
- A Converter that converts an Enum to a String.
- FallbackObjectToStringConverter
- A Converter that converts any object to string using toString().
- FloatGenericConverter
-
A converter that transforms a
Floatto a specific numeric subtype. - GenericNullConverter
- A contract for a converter that only matches under certain conditions.
- HashSetToCollectionGenericConverter
-
A converter that transforms a
HashSetto a specific collection subtype. - IntegerGenericConverter
-
A converter that transforms a
Integerto a specific numeric subtype. - IntGenericConverter
- A converter that transforms an int to a specific numeric subtype.
- IntToDateTimeConverter
- Converts int (epoch milliseconds) to DateTime
- IntToDurationConverter
- Converts int (milliseconds) to Duration
- IntToEnumConverterFactory
- A ConverterFactory that provides converters to convert integers to enums.
- IntToZonedDateTimeConverter
- Converts int (epoch milliseconds) to ZonedDateTime
- IterableToCollectionGenericConverter
- A converter that transforms an Iterable to a specific collection subtype.
- LinkedHashSetToCollectionGenericConverter
- A converter that transforms a col.LinkedHashSet to a specific collection subtype.
- LinkedListToCollectionGenericConverter
-
A converter that transforms a
LinkedListto a specific collection subtype. - LinkedQueueToCollectionGenericConverter
-
A converter that transforms a
LinkedQueueto a specific collection subtype. - LinkedStackToCollectionGenericConverter
-
A converter that transforms a
LinkedStackto a specific collection subtype. - ListableConverterRegistry
-
A ConverterRegistry that also provides access to registered
UriValidatorinstances. - ListBaseToCollectionConverter
- A converter that transforms a col.ListBase to a specific collection subtype.
- ListToCollectionConverter
- A converter that transforms a List to a specific collection subtype.
- ListToObjectConverter
- A Converter that converts a List to an Object (extracts single element).
- LocalDateAndLocalTimeToLocalDateTimeConverter
- Converts LocalDate and LocalTime to LocalDateTime
- LocalDateTimeToDateTimeConverter
- Converts LocalDateTime to DateTime (assumes UTC)
- LocalDateTimeToLocalDateConverter
- Converts LocalDateTime to LocalDate
- LocalDateTimeToLocalTimeConverter
- Converts LocalDateTime to LocalTime
- LocalDateTimeToStringConverter
- Converts LocalDateTime to String using ISO 8601 format
- LocalDateTimeToZonedDateTimeConverter
- Converts LocalDateTime to ZonedDateTime with specified zone
- LocalDateToDateTimeConverter
- Converts LocalDate to DateTime (at midnight UTC)
- LocalDateToStringConverter
- Converts LocalDate to String using ISO 8601 format
- LocaleToStringConverter
- LocalTimeToStringConverter
-
Converts LocalTime to String using HH:mm:ss
.SSSformat - LongGenericConverter
-
A converter that transforms a
Longto a specific numeric subtype. - MapToMapGenericConverter
- A converter that transforms a Map (or any map-like type) into another Map type, optionally converting keys and values.
- MapToStringGenericConverter
- A converter that transforms different types of Map into a String.
- NumberGenericConverter
- A converter that transforms a num to a specific numeric subtype.
- ObjectToListConverter
- A Converter that converts an Object to a List.
- ObjectToObjectConverter
- A Converter that converts an Object to another Object using reflection.
- ObjectToSetConverter
- A Converter that converts an Object to a Set.
- PairedConditionalConverter
- A bridge interface combining PairedConverter and ConditionalConverter.
- PairedConverter
- A general-purpose converter that can convert between multiple source–target type pairs.
- PatternToStringConverter
- A Converter that converts a Pattern to a String.
- QueueToCollectionGenericConverter
-
A converter that transforms a
Queueto a specific collection subtype. - RegExpToStringConverter
- A Converter that converts a RegExp to a String.
- RunesToStringConverter
- A Converter that converts a Runes to a String.
- SetBaseToCollectionGenericConverter
- A converter that transforms a col.SetBase to a specific collection subtype.
- SetToCollectionGenericConverter
- A converter that transforms a Set to a specific collection subtype.
- SetToObjectConverter
- A Converter that converts a Set to an Object (extracts single element).
- ShortGenericConverter
-
A converter that transforms a
Shortto a specific numeric subtype. - SimpleConversionService
- A configurable and extensible conversion service that provides a central mechanism for converting between types in JetLeaf applications.
- StackToCollectionGenericConverter
-
A converter that transforms a
Stackto a specific collection subtype. - StringGenericConverter
- A converter that transforms a String to a specific numeric subtype.
- StringToCurrencyConverter
-
A Converter that converts a String to a
Currency. - StringToDateTimeConverter
- Comprehensive collection of converters for time-related objects.
- StringToDurationConverter
- Converts String to Duration using Duration parsing
- StringToEnumConverterFactory
- A ConverterFactory that provides converters to convert strings to enums.
- StringToLocalDateConverter
- Converts String to LocalDate using LocalDate.parse()
- StringToLocalDateTimeConverter
- Converts String to LocalDateTime using LocalDateTime.parse()
- StringToLocaleConverter
-
A Converter that converts a String to a
Locale. - StringToLocalTimeConverter
- Converts String to LocalTime using LocalTime.parse()
- StringToMapGenericConverter
- A converter that transforms a String into different types of Map implementations.
- StringToPatternConverter
- A Converter that converts a String to a Pattern.
- StringToRegExpConverter
- A Converter that converts a String to a RegExp.
- StringToRunesConverter
- A Converter that converts a String to a Runes.
- StringToSymbolConverter
- A Converter that converts a String to a Symbol.
- StringToUriConverter
- A Converter that converts a String to a Uri.
- StringToUuidConverter
-
A Converter that converts a String to a
Uuid. - StringToZonedDateTimeConverter
- Converts String to ZonedDateTime using ZonedDateTime.parse()
- StringToZoneIdConverter
- Converts String to ZoneId using ZoneId()
- SymbolToStringConverter
- A Converter that converts a Symbol to a String.
- UriToStringConverter
- A Converter that converts a Uri to a String.
- UuidToStringConverter
-
A Converter that converts a
Uuidto a String. - ZonedDateTimeToDateTimeConverter
- Converts ZonedDateTime to DateTime
- ZonedDateTimeToIntConverter
- Converts ZonedDateTime to int (epoch milliseconds)
- ZonedDateTimeToLocalDateConverter
- Converts ZonedDateTime to LocalDate
- ZonedDateTimeToLocalDateTimeConverter
- Converts ZonedDateTime to LocalDateTime
- ZonedDateTimeToLocalTimeConverter
- Converts ZonedDateTime to LocalTime
- ZonedDateTimeToStringConverter
- Converts ZonedDateTime to String using ISO 8601 format with timezone
- ZonedDateTimeToZoneIdConverter
- Converts ZonedDateTime to ZoneId
- ZoneIdToStringConverter
- Converts ZoneId to String using the zone ID
Exceptions / Errors
- ConversionException
- Exception thrown when a type conversion fails in a ConversionService.
- ConversionFailedException
- Exception thrown when an actual type conversion attempt fails.
- ConverterNotFoundException
- Exception thrown when no suitable converter can be found for a given source and target type.