prepareTokens function

Map<String, dynamic> prepareTokens(
  1. Map<String, dynamic> map
)

Prepares the tokens by resolving the aliases and solving mathematical expressions.

Implementation

Map<String, dynamic> prepareTokens(Map<String, dynamic> map) {
  final metadata = map['\$metadata'];
  final List<String> tokenSetOrder =
      List<String>.from(metadata['tokenSetOrder']);

  for (final entry in map.entries) {
    if (!entry.key.startsWith('\$')) {
      final replaced = _resolveAliasesAndMath(
        entry.value,
        tokenSetOrder: tokenSetOrder.toList(),
        globalMap: map,
      );
      map[entry.key] = replaced;
    }
  }
  return map;
}