Skip to content

Commit 96cc8ae

Browse files
committed
docs: add some additional docs to new methods
1 parent ab00eab commit 96cc8ae

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

packages/dogs/lib/src/converters/enum.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ mixin EnumConverter<T> on DogConverter<T> {
7070
}
7171

7272

73+
/// A runtime string-based [EnumConverter] implementation
7374
class RuntimeEnumConverter extends SimpleDogConverter<String> with EnumConverter<String> {
7475
@override
7576
final List<String> values;

packages/dogs/lib/src/extensions.dart

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,9 @@ extension DogEngineShortcuts on DogEngine {
157157
return convertIterableFromNative(value, type ?? T, kind);
158158
}
159159

160+
/// Converts a field map to an instance of [T] using the structure
161+
/// associated with [T] or [type] and the supplied [IterableKind].
162+
/// If [tree] is supplied, the structure associated with the tree is used.
160163
T fromFieldMap<T>(Map<String,dynamic> fieldMap, {IterableKind kind = IterableKind.none, Type? type, TypeTree? tree}) {
161164
final structureType = tree?.base.typeArgument ?? type ?? T;
162165
final structure = findStructureByType(structureType);
@@ -166,6 +169,10 @@ extension DogEngineShortcuts on DogEngine {
166169
return structure.instantiateFromFieldMap(fieldMap);
167170
}
168171

172+
173+
/// Converts a value of type [T] to a field map using the structure
174+
/// associated with [T] or [type] and the supplied [IterableKind].
175+
/// If [tree] is supplied, the structure associated with the tree is used.
169176
Map<String,dynamic> toFieldMap<T>(T value, {IterableKind kind = IterableKind.none, Type? type, TypeTree? tree}) {
170177
final structureType = tree?.base.typeArgument ?? type ?? T;
171178
final structure = findStructureByType(structureType);

packages/dogs/lib/src/schema/spec.dart

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,12 @@ extension SchemaGenerateExtension on DogEngine {
3333
return converter.describeOutput(this, config);
3434
});
3535
}
36-
36+
37+
/// Materializes a [type] schema, creating a [MaterializedConverter] that
38+
/// can be used to convert data to and from the schema.
39+
///
40+
/// Materialization will create an engine fork with the custom types defined
41+
/// in the schema.
3742
MaterializedConverter materialize(SchemaType type) {
3843
return DogsMaterializer.get(this).materialize(type);
3944
}

0 commit comments

Comments
 (0)