getFields<T> method

List<T> getFields<T>(
  1. int tag, {
  2. bool allowNull = true,
})

Implementation

List<T> getFields<T>(int tag, {bool allowNull = true}) {
  final result = where((element) => element.tagNumber == tag);
  if (result.isEmpty && !allowNull) {
    throw TronPluginException('field id does not exist.',
        details: {'fieldIds': map((e) => e.tagNumber).join(', '), 'id': tag});
  }
  return result.map((e) => e.get<T>()).toList();
}