Skip to content
This repository has been archived by the owner on Apr 29, 2021. It is now read-only.

Remove whitespaces from parsed results #8

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion lib/src/parser.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ class SvgParserDefinition extends SvgGrammarDefinition {
const SvgParserDefinition();

@override
svgPath() => super.svgPath().map((Iterable r) => r.toList(growable: false));
svgPath() => super.svgPath().map((result) {
result = result.map((r) => r.where((p) => p is SvgPathSegment));
return result.toList(growable: false);
});

@override
moveToDrawToCommandGroup() => super.moveToDrawToCommandGroup().map((result) {
Expand Down
2 changes: 1 addition & 1 deletion test/parser_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ void main() {
});

test('parseSvgPath works as intended', () {
expect(svg.parseSvgPath('M0,15,L15,15L7.5,0z'), const [
expect(svg.parseSvgPath(' M0,15,L15,15 L 7.5,0z '), const [
const SvgPathMoveSegment(0, 15),
const SvgPathLineSegment(15, 15),
const SvgPathLineSegment(7.5, 0),
Expand Down