toInputFormat method

List<String> toInputFormat()

Formats the data as a list of strings

If the key is an integer, it means the original input was a single value. If the key is not an integer, it means the original input was a key-value pair.

Returns

  • The extra info data formatted as a list of strings

Throws

  • An exception if it fails

Implementation

List<String> toInputFormat() {
  final List<String> output = <String>[];
  _data.forEach((final dynamic key, final dynamic value) {
    if (key is int) {
      // If the key is an integer, it means the original input was a single value
      output.add(value);
    } else {
      // If the key is not an integer, it means the original input was a key-value pair
      output.add('$key = $value');
    }
  });
  return output;
}