getValue method

double? getValue(
  1. String id
)

API to get value for ID.

Parameters: id Unique ID to get value. Return double value

Exceptions: Throws an ArgumentError if the ID is empty. Throws an ArgumentError if the ID is invalid.

Implementation

double? getValue(String id)
{
  if (id.isEmpty) {
    throw ArgumentError("You must set itemId.");
  }

  final index = items!.indexWhere((items) => items.id == id);
  if (index > -1) {
    return items!.elementAt(index).dValue;
  }
  throw ArgumentError("id is invalid.");
}