getTokenSets function

List<String> getTokenSets(
  1. Map<String, dynamic> tokens, {
  2. required BuilderConfig config,
  3. bool includeDefaultSet = false,
})

Parses token sets from token data and returns a list of all available tokens sets.

Removed the default set from the output.

Implementation

List<String> getTokenSets(
  Map<String, dynamic> tokens, {
  required BuilderConfig config,
  bool includeDefaultSet = false,
}) {
  final tokenSets = List<String>.from(
    (tokens['\$metadata']['tokenSetOrder'] as List).cast<String>(),
  );

  if (!includeDefaultSet) {
    tokenSets.remove(config.defaultSetName);
  }

  return tokenSets;
}