getPreferredUnit function

String getPreferredUnit(
  1. FinancialMetric metric
)

Gets the appropriate unit type for a metric.

Implementation

String getPreferredUnit(FinancialMetric metric) {
  switch (metric) {
    case FinancialMetric.earningsPerShareBasic:
    case FinancialMetric.earningsPerShareDiluted:
    case FinancialMetric.dividendsPerShare:
      return 'USD/shares';
    case FinancialMetric.sharesOutstanding:
      return 'shares';
    default:
      return 'USD';
  }
}