# Storing and Send

When storing and sending monetary amounts you need to ensure that you retain the precision and decimal digits of the amount.

The best way to do this is to store the amount is three components.

* Minor units
* Decimal Digits
* The currencies ISO Code

A value of $AUD1.99 would be stored as:

Minor Units: 199

Decimal Digits: 2

ISO Code: AUD

Using this technique guarantees you will always get back the amount you stored or transmitted.

If you are only using a single currency the Fixed package provides tools to store the minor units and decimal digits.

The Money package allows you to convert a Money amount to from a json format.

```dart

     test('formatting', () {
      final money = Money.fromInt(1025, isoCode: 'USD');
      final moneyJson = money.toJson();

      final expectedJson = <String, dynamic>{
        'minorUnits': '1025',
        'decimals': 2,
        'isoCode': 'USD',
      };

      expect(moneyJson, equals(expectedJson));

      final retrievedAmount = Money.fromJson(moneyJson);
      expect(retrievedAmount.minorUnits.toInt(), equals(1025));
      expect(retrievedAmount.decimalDigits, equals(2));
      expect(retrievedAmount.currency.isoCode, equals('USD'));
    });
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://money2.onepub.dev/storing-and-send.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
