> ## Documentation Index
> Fetch the complete documentation index at: https://starrycodes.mintlify.app/llms.txt
> Use this file to discover all available pages before exploring further.

# num - Formatting & Currency

> Functional utilities for complex list mapping, efficient sorting by property (selector), chunking for pagination, and creating shuffled copies.

<Steps titleSize="h3">
  <Step title="💰 Currency Formatting">
    <ResponseField name="toCurrency()" type="String">
      <Expandable title="Parameters">
        <ParamField body="decimalPlaces" type="int" default="2">
          The number of digits to display after the decimal point.
        </ParamField>

        <ParamField body="currencySymbol" type="String?" default="'KES'">
          The symbol to use (e.g., 'KES', '\$'). Set to `null` to display no symbol.
        </ParamField>

        <ParamField body="currencyDirection" type="CurrencyDirection" default="CurrencyDirection.left">
          Placement of the currency symbol (left or right).
        </ParamField>

        <ParamField body="thousandsSeparator" type="String" default="','">
          The `character` used to separate thousands.
        </ParamField>

        <ParamField body="decimalSeparator" type="String" default="'.'">
          The `character` used to separate the whole number from the decimals.
        </ParamField>
      </Expandable>

      Converts the number to a given currency format, correctly handling thousand separators, decimal places, and symbol placement.

      ```dart lines wrap theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
      final euroAmount = 9876.5;
      print(euroAmount.toCurrency(
        currencySymbol: '€',
        thousandsSeparator: '.',
        decimalSeparator: ',',
        currencyDirection: CurrencyDirection.right,
      ));
      // 9.876,50 €
      ```
    </ResponseField>
  </Step>

  <Step title="📊 Abbreviation">
    <ResponseField name="toAbbreviated()" type="String">
      <Expandable title="Parameters">
        <ParamField body="decimalCount" type="int" default="1">
          The number of decimal places to include.
        </ParamField>

        <ParamField body="isLowercase" type="bool" default="false">
          If `true`, uses lowercase suffixes (b, m, k).
        </ParamField>

        <ParamField body="currencySymbol" type="String?">
          An optional symbol to prefix/suffix the result.
        </ParamField>

        <ParamField body="currencyDirection" type="CurrencyDirection" default="CurrencyDirection.left">
          Placement of the currency symbol (left or right).
        </ParamField>
      </Expandable>

      Abbreviates the number to a concise format (e.g., 1.1B, 2.0K). Used for displaying large counts cleanly in UIs.

      ```dart lines wrap theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
      print(1000000000.toAbbreviated(currencySymbol: 'USD')); // USD 1.0B
      ```
    </ResponseField>
  </Step>
</Steps>
