MIoTSpecType.parse constructor
MIoTSpecType.parse(
- String specType
Implementation
factory MIoTSpecType.parse(String specType) {
final list = specType.split(':');
if (list.length < 5 || list.first != 'urn') {
throw FormatException('Invalid specification type.');
}
return MIoTSpecType(
namespace: list[1],
type: MIoTSpecTypeKind.values.firstWhere(
(e) => e.name == list[2],
orElse: () => throw FormatException('Invalid specification type.'),
),
name: list[3],
value: int.parse(list[4], radix: 16),
product: list.length >= 6 ? list[5] : null,
version: list.length >= 7 ? int.parse(list[6]) : null,
id: list.length >= 8 ? int.parse(list[7], radix: 16) : null,
);
}