Skip to content
Merged
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
2 changes: 2 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ jobs:
shell: bash
run: |
curl -fsSL https://fvm.app/install.sh | bash
echo "/home/runner/fvm/bin" >> $GITHUB_PATH
export PATH="/home/runner/fvm/bin:$PATH"
fvm use stable --force

- uses: kuhnroyal/flutter-fvm-config-action@v2
Expand Down
2 changes: 1 addition & 1 deletion packages/core/lib/src/models/block_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ class SectionBlock extends Block {
'align': ContentAlignment.schema.nullable().optional(),
'flex': Ack.integer().nullable().optional(),
'scrollable': Ack.boolean().nullable().optional(),
'blocks': Ack.list(Ack.object({})).nullable().optional(),
'blocks': Ack.list(Block.discriminatedSchema).nullable().optional(),
}, additionalProperties: true);

@override
Expand Down
16 changes: 16 additions & 0 deletions packages/core/lib/src/models/deck_model.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:ack/ack.dart';
import 'package:collection/collection.dart';

import '../deck_configuration.dart';
Expand Down Expand Up @@ -36,6 +37,21 @@ class Deck {
);
}

/// Ack schema for validating complete deck/presentation JSON.
static final schema = Ack.object({
'slides': Ack.list(Slide.schema),
'configuration': DeckConfiguration.schema.nullable().optional(),
});

/// Parses a deck from a JSON map with validation.
///
/// Validates the map against the schema before parsing.
/// Throws an exception if the validation fails.
static Deck parse(Map<String, dynamic> map) {
schema.parse(map);
return fromMap(map);
}

@override
bool operator ==(Object other) =>
identical(this, other) ||
Expand Down
Loading
Loading