parse method
Attempts to parse the raw Result's contents as a particular type of information (email, URL, etc.) and return a ParsedResult encapsulating the result of parsing.
@param theResult the raw Result to parse @return ParsedResult encapsulating the parsing result
Implementation
@override
AddressBookParsedResult? parse(Result result) {
final rawText = ResultParser.getMassagedText(result);
if (!rawText.startsWith('BIZCARD:')) {
return null;
}
final firstName = matchSingleDoCoMoPrefixedField('N:', rawText, true);
final lastName = matchSingleDoCoMoPrefixedField('X:', rawText, true);
final fullName = _buildName(firstName, lastName);
final title = matchSingleDoCoMoPrefixedField('T:', rawText, true);
final org = matchSingleDoCoMoPrefixedField('C:', rawText, true);
final addresses = matchDoCoMoPrefixedField('A:', rawText);
final phoneNumber1 = matchSingleDoCoMoPrefixedField('B:', rawText, true);
final phoneNumber2 = matchSingleDoCoMoPrefixedField('M:', rawText, true);
final phoneNumber3 = matchSingleDoCoMoPrefixedField('F:', rawText, true);
final email = matchSingleDoCoMoPrefixedField('E:', rawText, true);
return AddressBookParsedResult.full(
maybeWrap(fullName),
null,
null,
_buildPhoneNumbers(phoneNumber1, phoneNumber2, phoneNumber3),
null,
maybeWrap(email),
null,
null,
null,
addresses,
null,
org,
null,
title,
null,
null,
);
}