pkg_data_parser version: 0.0.23

Published 2025-07-23

ruud

sdk | dart
repository | svn
platform | generic
status | n/a
  • Readme
  • Changelog
  • Versions

pkg_data_parser

Parse spreadsheet data to a list of VO's.

graph

Uses enums to check and force required spreadsheet sheets and columns.

Handles variations in sheet names and column headers by mapping different values to a single enum key.

  • Checks required sheet names.
  • Checks required column headers.
  • Checks duplicate column headers.
  • You can fetch the matched fields per row with getField.
  • You can fetch unmatched fields per row (as json) with getUnmatched.

Parse

try {
  final DataParser<SheetNames, DataHeaders, Data> parser =
      DataParser<SheetNames, DataHeaders, Data>(
    spreadsheet: spreadsheet,
    sheet: SheetNames.spec,
    sheets: mapRequiredSheetDefinitions,
    headers: mapRequiredColumnDefinitions,
    generator: Data.fromRow,
  );
  
  final List<Data> data = parser.parse();
  
  expect(data.isNotEmpty, true);
} on MissingSheetsException catch (e) {
  rethrow;
} on MissingHeadersException catch (e) {
rethrow;
} on DuplicateHeadersException catch (e) {
rethrow;
}

Helpers

Convert a json map to a typed map.

enum SheetNames {
  spec,
  allocations,
}

final Map<String, dynamic> json = <String, dynamic>{
  'Specs': 'spec',
  'Specifications': 'spec',
  'Allocations': 'allocations',
};

final Map<String, SheetNames> map =
    jsonToMappedEnum<SheetNames>(json, SheetNames.values);

expect(map.length, 2);

Changelog

0.0.23 - 2025-07-23

Changed

  • Version bump from 0.0.22 to 0.0.23 (test -> 1.26.3 (was 1.26.2)).

0.0.22 - 2025-05-22

Changed

  • Version bump from 0.0.21 to 0.0.22 (lints -> 6.0.0 (was 5.1.1)).

0.0.21 - 2025-05-22

Changed

  • Version bump from 0.0.20 to 0.0.21 (test -> 1.26.2 (was 1.26.1)).

0.0.20 - 2025-05-20

Changed

  • Version bump from 0.0.19 to 0.0.20 (test -> 1.26.1 (was 1.26.0)).

0.0.19 - 2025-05-13

Changed

  • Version bump from 0.0.18 to 0.0.19 (test -> 1.26.0 (was 1.25.15)).

0.0.18 - 2025-04-02

Changed

  • Version bump from 0.0.17 to 0.0.18 (test -> 1.25.15 (was 1.25.14)).

0.0.17 - 2024-12-23

Changed

  • Version bump from 0.0.16 to 0.0.17 (test -> 1.25.14 (was 1.25.13)).

0.0.16 - 2024-12-23

Changed

  • Version bump from 0.0.15 to 0.0.16 (lints -> 5.1.1 (was 5.1.0)).

0.0.15 - 2024-12-19

Changed

  • Version bump from 0.0.14 to 0.0.15 (Support Apple silicon (arm64)).

0.0.14 - 2024-12-18

Changed

  • Version bump from 0.0.13 to 0.0.14 (test -> 1.25.13 (was 1.25.12)).

0.0.13 - 2024-12-12

Changed

  • Version bump from 0.0.12 to 0.0.13 (lints -> 5.1.0 (was 5.0.0)).

0.0.12 - 2024-12-05

Changed

  • Version bump from 0.0.11 to 0.0.12 (test -> 1.25.12 (was 1.25.11)).

0.0.11 - 2024-12-04

Changed

  • Version bump from 0.0.10 to 0.0.11 (test -> 1.25.11 (was 1.25.10)).

0.0.10 - 2024-12-03

Changed

  • Version bump from 0.0.9 to 0.0.10 (test -> 1.25.10 (was 1.25.9)).

0.0.9 - 2024-11-27

Changed

  • Version bump from 0.0.8 to 0.0.9 (test -> 1.25.9 (was 1.25.8)).

0.0.8 - 2024-08-22

Changed

  • Version bump from 0.0.7 to 0.0.8 (SDK update 3.5.1).

0.0.7 - 2024-02-01

Changed

  • Version bump from 0.0.6 to 0.0.7 (Resolve package version confusions).

0.0.6 - 2023-09-12

Fixed

  • Got a row-count while parsing unmatched fields, but needed a column-count.

0.0.5 - 2023-02-09

Changed

  • Version bump from 0.0.4 to 0.0.5 (Version confusion after compiler bug chaos).

0.0.4 - 2022-12-27

Changed

  • Version bump from 0.0.3 to 0.0.4.

0.0.3 - 2022-12-22

Changed

  • Version bump from 0.0.2 to 0.0.3.

0.0.2 - 2022-12-22

Changed

  • Version bump from 0.0.1 to 0.0.2 (Recompile due to installer optimizations).

0.0.1 - 2022-11-11

Changed

  • Initial version.

0.0.23

2025-07-23 download

0.0.22

2025-05-22 download

0.0.20

2025-05-20 download

0.0.19

2025-05-13 download

0.0.18

2025-04-02 download

0.0.17

2024-12-23 download

0.0.15

2024-12-19 download

0.0.14

2024-12-18 download

0.0.13

2024-12-12 download

0.0.9

2024-11-27 download

0.0.8

2024-08-22 download

0.0.7

2024-02-01 download

0.0.6

2023-09-12 download

0.0.5

2023-02-09 download

0.0.4

2022-12-27 download

0.0.3

2022-12-22 download

0.0.2

2022-12-22 download

0.0.1

2022-11-11 download