toFormResult method

Future<FormResultFree> toFormResult(
  1. Map<String, Object?> document
)

Converts a raw MongoDB document to a FormResultFree object.

This method processes a document through the form validation system and returns the complete validation result, which includes both the processed data and any validation information.

Parameters:

  • document - The raw MongoDB document to process

Returns a FormResultFree containing validation results and processed data.

Example:

var rawDoc = await collection.collection.findOne({'_id': objectId});
var formResult = await collection.toFormResult(rawDoc);
if (formResult.success) {
  print('Document is valid');
}

Implementation

Future<FormResultFree> toFormResult(Map<String, Object?> document) async {
  return await validate(document);
}