parse method

void parse(
  1. Map<String, dynamic> input
)

Parses the given json map recursively and saves the tokens in the tokenMap.

Implementation

void parse(Map<String, dynamic> input) {
  if (themes.isEmpty) {
    themes = [TokenTheme(kDefaultThemeName, sets)];
  }

  for (final theme in themes) {
    final Map<String, dynamic> tokensForTheme;
    if (theme.sets.isEmpty) {
      tokensForTheme = input;
    } else {
      tokensForTheme = {};
      for (final set in theme.sets) {
        tokensForTheme[set] = input[set] as Map<String, dynamic>;
      }
    }

    final tokens = findTokens('.', tokensForTheme);
    _postProcess(tokens);

    theme.addTokens(tokens);
  }
}