AdaptableMap.create constructor

AdaptableMap.create(
  1. Map<Object, Object> entries
)

A specialized map collection that can adapt itself or another source into a strongly-typed Map of keys and values.

The AdaptableMap extends HashMap<Object, Object> and provides a generic adapt method to convert:

Purpose

This class is intended to:

  • Facilitate type-safe conversion for heterogeneous or dynamic maps.
  • Allow seamless adaptation between JetLeaf and standard Dart map types.
  • Support framework-level or service-level map transformation.

Features

Lifecycle and Usage

final adaptable = AdaptableMap();
adaptable['key'] = 42;
final typedMap = adaptable.adapt<String, int>(); // Map<String, int>

final source = collection.HashMap<dynamic, dynamic>();
source['name'] = 'JetLeaf';
final map = adaptable.adapt<String, String>(source); // Map<String, String>

Extensibility

  • Subclass AdaptableMap to implement custom key/value conversion rules.
  • Can integrate with conversion services or framework-specific registries.

Error Handling

See Also

Implementation

factory AdaptableMap.create(Map<Object, Object> entries) {
  final map = AdaptableMap();
  map.addAll(entries);
  return map;
}