### Example pubspec.yaml Entry Source: https://pub.dev/packages/money_formatter/versions/0.0.4/install This is an example of how the money_formatter dependency will appear in your pubspec.yaml file after running the add command. ```yaml dependencies: money_formatter: ^0.0.4 ``` -------------------------------- ### Example pubspec.yaml Entry Source: https://pub.dev/packages/money_formatter/versions/0.0.2/install This is how the dependency will appear in your pubspec.yaml file after running the add command. ```yaml dependencies: money_formatter: ^0.0.2 ``` -------------------------------- ### Example pubspec.yaml Dependency Source: https://pub.dev/packages/money_formatter/versions/0.0.1/install This is how the dependency will appear in your pubspec.yaml file after running the add command. ```yaml dependencies: money_formatter: ^0.0.1 ``` -------------------------------- ### Comparator Example Source: https://pub.dev/packages/money_formatter/versions/0.0.2/example Shows how to use the comparator to check if two currency amounts are equal. ```dart subtitle: Text( '${fmf.comparator.isEqual(5000)}', style: subtitleStyle, ), ``` -------------------------------- ### Fast Calculation Example 1 Source: https://pub.dev/packages/money_formatter/versions/0.0.6/example Demonstrates chained fast calculations (addition then subtraction) and displays the result without a symbol. ```dart subtitle: Text( '${MoneyFormatter(amount: 12345.678).fastCalc(type: FastCalcType.addition, amount: 1.111).fastCalc(type: FastCalcType.substraction, amount: 2.222).output.nonSymbol}', style: subtitleStyle, ), ``` -------------------------------- ### Basic Money Formatting Example Source: https://pub.dev/packages/money_formatter/versions/0.0.2/example Demonstrates the default formatting of a currency amount using MoneyFormatter. Shows how to display the formatted value with and without currency symbols and decimal places. ```dart import 'package:flutter/material.dart'; import 'package:money_formatter/money_formatter.dart'; void main() => runApp(MyApp()); class MyApp extends StatefulWidget { @override _MyAppState createState() => _MyAppState(); } class _MyAppState extends State { @override Widget build(BuildContext context) { TextStyle titleStyle = TextStyle(fontSize: 24.0, fontWeight: FontWeight.bold); TextStyle subtitleStyle = TextStyle(fontSize: 20.0); MoneyFormatter fmf = MoneyFormatter(amount: 12345678.9012345); MoneyFormatterOutput fo = fmf.output; return MaterialApp( home: Scaffold( appBar: AppBar( title: const Text('Money Formatter Demo'), ), body: SingleChildScrollView( child: ConstrainedBox( constraints: BoxConstraints(), child: Container( padding: EdgeInsets.all(15.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ ListTile( title: Text( 'FormattedNonSymbol :', style: titleStyle, ), subtitle: Text( fo.nonSymbol, style: subtitleStyle, ), ), ListTile( title: Text( 'FormattedLeftSymbol :', style: titleStyle, ), subtitle: Text( fo.symbolOnLeft, style: subtitleStyle, ), ), ListTile( title: Text( 'FormattedRightSymbol :', style: titleStyle, ), subtitle: Text( fo.symbolOnRight, style: subtitleStyle, ), ), ListTile( title: Text( 'FormattedWithoutDecimal :', style: titleStyle, ), subtitle: Text( fo.withoutFractionDigits, style: subtitleStyle, ), ), ListTile( title: Text( 'DecimalOnly :', style: titleStyle, ), subtitle: Text( fo.fractionDigitsOnly, style: subtitleStyle, ), ), ListTile( title: Text( 'FormattedNonSymbolCustom :', style: titleStyle, ), subtitle: Text( fmf .copyWith(amount: 123.4567, fractionDigits: 4) .output .nonSymbol, style: subtitleStyle, ), ), ListTile( title: Text( 'FormattedLeftSymbolCustom :', style: titleStyle, ), subtitle: Text( fmf .copyWith( symbol: 'IDR', symbolAndNumberSeparator: '-') .output .symbolOnLeft, style: subtitleStyle, ), ), ListTile( title: Text( 'CompactNonSymbol :', style: titleStyle, ), subtitle: Text( fmf .copyWith(amount: 12345678987654321.9012345) .output .compactNonSymbol, style: subtitleStyle, ), ), ListTile( title: Text( 'CompactLongNonSymbol :', ``` -------------------------------- ### Compact Format Examples Source: https://pub.dev/packages/money_formatter/versions/0.0.2/example Demonstrates different compact formatting options for currency amounts, including long and short compact formats with symbols on the left or right. ```dart subtitle: Text( fmf .copyWith(amount: 12345678987654321.9012345, compactFormatType: CompactFormatType.long) .output .compactNonSymbol, style: subtitleStyle, ), ``` ```dart subtitle: Text( fmf .copyWith(amount: 1234.56789) .output .compactSymbolOnLeft, style: subtitleStyle, ), ``` ```dart subtitle: Text( fmf .copyWith( amount: 123456.7890, compactFormatType: CompactFormatType.short) .output .compactSymbolOnRight, style: subtitleStyle, ), ``` -------------------------------- ### MoneyFormatter Comparison Example Source: https://pub.dev/packages/money_formatter Demonstrates how to use the MoneyFormatter's comparator methods to check relationships between amounts. Ensure the MoneyFormatter is initialized with the amount to compare. ```dart MoneyFormatter fmf = MoneyFormatter(amount: 12345678.9012345); double comparerValue = 5678.9012; print(fmf.comparator.isEqual(comparerValue)); // false print(fmf.comparator.isGreaterThan(comparerValue)); // true ``` -------------------------------- ### Initialize MoneyFormatter and Get Output Directly Source: https://pub.dev/packages/money_formatter Instantiate MoneyFormatter and access its output in a single chained call for conciseness. ```dart MoneyFormatterOutput fo = MoneyFormatter( amount: 12345678.9012345 ).output; ``` -------------------------------- ### Fast Calculation Examples Source: https://pub.dev/packages/money_formatter/versions/0.0.1/example Shows how to perform chained addition and subtraction operations using the fastCalc method. Useful for quick, in-memory monetary calculations without full formatting. ```dart MoneyFormatter(amount: 12345.678).fastCalc(type: FastCalcType.addition, amount: 1.111).fastCalc(type: FastCalcType.substraction, amount: 2.222).output.nonSymbol ``` ```dart fmf.fastCalc(type: FastCalcType.addition, amount: 1234.567).fastCalc(type: FastCalcType.substraction, amount: 234.5678).output.nonSymbol ``` -------------------------------- ### Get Formatted Output (Default Settings) Source: https://pub.dev/packages/money_formatter Access various formatted string representations of the amount, including normal and compact forms, with or without currency symbols. ```dart // normal form print(fmf.output.nonSymbol); // 12,345,678.90 print(fmf.output.symbolOnLeft); // $ 12,345,678.90 print(fmf.output.symbolOnRight); // 12,345,678.90 $ print(fmf.output.fractionDigitsOnly); // 90 print(fmf.output.withoutFractionDigits); // 12,345,678 // compact form print(fmf.output.compactNonSymbol) // 12.3M print(fmf.output.compactSymbolOnLeft) // $ 12.3M print(fmf.output.compactSymbolOnRight) // 12.3M $ ``` -------------------------------- ### Fast Calculation Example 1 Source: https://pub.dev/packages/money_formatter/versions/0.0.5/example Performs addition and subtraction using the fastCalc method and displays the result without a symbol. ```dart subtitle: Text( '${MoneyFormatter(amount: 12345.678).fastCalc(type: FastCalcType.addition, amount: 1.111).fastCalc(type: FastCalcType.substraction, amount: 2.222).output.nonSymbol}', style: subtitleStyle, ), ``` -------------------------------- ### Initialize MoneyFormatter with Default Settings Source: https://pub.dev/packages/money_formatter Create an instance of MoneyFormatter with a double amount to format it using default configurations. ```dart MoneyFormatter fmf = MoneyFormatter( amount: 12345678.9012345 ); ``` -------------------------------- ### FastCalc Implementation Source: https://pub.dev/packages/money_formatter Demonstrates the implementation of the `fastCalc` function for addition and subtraction, showing how to access the non-symbol output. ```dart MoneyFormatter fmf = MoneyFormatter(amount: 12345.678); fmf.fastCalc(type: FastCalcType.addition, amount: 1.111); fmf.fastCalc(type: FastCalcType.substraction, amount: 2.222); print(fmf.output.nonSymbol); // 12,345.68 ``` -------------------------------- ### Fast Calculation with Formatter Instance Source: https://pub.dev/packages/money_formatter/example Shows how to perform chained fast calculations using an existing MoneyFormatter instance, displaying the result without a symbol. ```dart fmf.fastCalc(type: FastCalcType.addition, amount: 1234.567).fastCalc(type: FastCalcType.substraction, amount: 234.5678).output.nonSymbol ``` -------------------------------- ### Compact Formatting with Symbol Source: https://pub.dev/packages/money_formatter/versions/0.0.1/example Demonstrates compact formatting with different compact format types and symbol placement. Use this for displaying large numbers in a concise, human-readable format. ```dart fmf.copyWith(amount: 12345678987654321.9012345, compactFormatType: CompactFormatType.long).output.compactNonSymbol ``` ```dart fmf.copyWith(amount: 1234.56789).output.compactSymbolOnLeft ``` ```dart fmf.copyWith(amount: 123456.7890, compactFormatType: CompactFormatType.short).output.compactSymbolOnRight ``` -------------------------------- ### Initialize MoneyFormatter with Custom Settings Source: https://pub.dev/packages/money_formatter Configure MoneyFormatter with specific settings for currency symbol, separators, decimal places, and compact format type. ```dart MoneyFormatter fmf = new MoneyFormatter( amount: 12345678.9012345, settings: MoneyFormatterSettings( symbol: 'IDR', thousandSeparator: '.', decimalSeparator: ',', symbolAndNumberSeparator: ' ', fractionDigits: 3, compactFormatType: CompactFormatType.sort ) ) ``` -------------------------------- ### Fast Calculation (Addition and Subtraction) Source: https://pub.dev/packages/money_formatter/example Demonstrates chained fast calculations for addition and subtraction on a monetary amount, displaying the result without a symbol. ```dart MoneyFormatter(amount: 12345.678).fastCalc(type: FastCalcType.addition, amount: 1.111).fastCalc(type: FastCalcType.substraction, amount: 2.222).output.nonSymbol ``` -------------------------------- ### Basic Currency Formatting Source: https://pub.dev/packages/money_formatter/example Demonstrates default formatting of a currency amount, showing non-symbol, left-symbol, right-symbol, without decimal, and decimal-only outputs. ```dart import 'package:flutter/material.dart'; import 'package:money_formatter/money_formatter.dart'; void main() => runApp(MyApp()); class MyApp extends StatefulWidget { @override _MyAppState createState() => _MyAppState(); } class _MyAppState extends State { @override Widget build(BuildContext context) { TextStyle titleStyle = TextStyle(fontSize: 24.0, fontWeight: FontWeight.bold); TextStyle subtitleStyle = TextStyle(fontSize: 20.0); MoneyFormatter fmf = MoneyFormatter(amount: 12345678.9012345); MoneyFormatterOutput fo = fmf.output; return MaterialApp( home: Scaffold( appBar: AppBar( title: const Text('Money Formatter Demo'), ), body: SingleChildScrollView( child: ConstrainedBox( constraints: BoxConstraints(), child: Container( padding: EdgeInsets.all(15.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ ListTile( title: Text( 'FormattedNonSymbol :', style: titleStyle, ), subtitle: Text( fo.nonSymbol, style: subtitleStyle, ), ), ListTile( title: Text( 'FormattedLeftSymbol :', style: titleStyle, ), subtitle: Text( fo.symbolOnLeft, style: subtitleStyle, ), ), ListTile( title: Text( 'FormattedRightSymbol :', style: titleStyle, ), subtitle: Text( fo.symbolOnRight, style: subtitleStyle, ), ), ListTile( title: Text( 'FormattedWithoutDecimal :', style: titleStyle, ), subtitle: Text( fo.withoutFractionDigits, style: subtitleStyle, ), ), ListTile( title: Text( 'DecimalOnly :', style: titleStyle, ), subtitle: Text( fo.fractionDigitsOnly, style: subtitleStyle, ), ), ListTile( title: Text( 'FormattedNonSymbolCustom :', style: titleStyle, ), subtitle: Text( fmf .copyWith(amount: 123.4567, fractionDigits: 4) .output .nonSymbol, style: subtitleStyle, ), ), ListTile( title: Text( 'FormattedLeftSymbolCustom :', style: titleStyle, ), subtitle: Text( fmf .copyWith( symbol: 'IDR', symbolAndNumberSeparator: '-') .output .symbolOnLeft, style: subtitleStyle, ), ), ListTile( title: Text( 'CompactNonSymbol :', style: titleStyle, ), subtitle: Text( fmf .copyWith(amount: 12345678987654321.9012345) .output .compactNonSymbol, style: subtitleStyle, ), ), ListTile( title: Text( 'CompactLongNonSymbol :', style: titleStyle, ), subtitle: Text( fmf .copyWith(amount: 12345678987654321.9012345) .output .compactLongNonSymbol, style: subtitleStyle, ), ) ], ), ))), )), ); } } ``` -------------------------------- ### Add money_formatter Dependency to Flutter Project Source: https://pub.dev/packages/money_formatter/versions/0.0.1/install Run this command in your project's root directory to add the package. This automatically updates your pubspec.yaml file. ```bash $ flutter pub add money_formatter ``` -------------------------------- ### Basic Money Formatting Source: https://pub.dev/packages/money_formatter/versions/0.0.3/example Demonstrates default formatting of a currency amount, showing various output formats like non-symbol, symbol on left/right, without decimals, and decimal only. ```dart import 'package:flutter/material.dart'; import 'package:money_formatter/money_formatter.dart'; void main() => runApp(MyApp()); class MyApp extends StatefulWidget { @override _MyAppState createState() => _MyAppState(); } class _MyAppState extends State { @override Widget build(BuildContext context) { TextStyle titleStyle = TextStyle(fontSize: 24.0, fontWeight: FontWeight.bold); TextStyle subtitleStyle = TextStyle(fontSize: 20.0); MoneyFormatter fmf = MoneyFormatter(amount: 12345678.9012345); MoneyFormatterOutput fo = fmf.output; return MaterialApp( home: Scaffold( appBar: AppBar( title: const Text('Money Formatter Demo'), ), body: SingleChildScrollView( child: ConstrainedBox( constraints: BoxConstraints(), child: Container( padding: EdgeInsets.all(15.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ ListTile( title: Text( 'FormattedNonSymbol :', style: titleStyle, ), subtitle: Text( fo.nonSymbol, style: subtitleStyle, ), ), ListTile( title: Text( 'FormattedLeftSymbol :', style: titleStyle, ), subtitle: Text( fo.symbolOnLeft, style: subtitleStyle, ), ), ListTile( title: Text( 'FormattedRightSymbol :', style: titleStyle, ), subtitle: Text( fo.symbolOnRight, style: subtitleStyle, ), ), ListTile( title: Text( 'FormattedWithoutDecimal :', style: titleStyle, ), subtitle: Text( fo.withoutFractionDigits, style: subtitleStyle, ), ), ListTile( title: Text( 'DecimalOnly :', style: titleStyle, ), subtitle: Text( fo.fractionDigitsOnly, style: subtitleStyle, ), ), ListTile( title: Text( 'FormattedNonSymbolCustom :', style: titleStyle, ), subtitle: Text( fmf .copyWith(amount: 123.4567, fractionDigits: 4) .output .nonSymbol, style: subtitleStyle, ), ), ListTile( title: Text( 'FormattedLeftSymbolCustom :', style: titleStyle, ), subtitle: Text( fmf .copyWith( symbol: 'IDR', symbolAndNumberSeparator: '-') .output .symbolOnLeft, style: subtitleStyle, ), ), ListTile( title: Text( 'CompactNonSymbol :', style: titleStyle, ), subtitle: Text( fmf .copyWith(amount: 12345678987654321.9012345) .output .compactNonSymbol, style: subtitleStyle, ), ), ListTile( title: Text( 'CompactLongNonSymbol :', ``` -------------------------------- ### FastCalc Chaining Implementation Source: https://pub.dev/packages/money_formatter Shows a more concise implementation of `fastCalc` using method chaining for performing calculations and accessing the non-symbol output. ```dart MoneyFormatter fmf = MoneyFormatter(amount: 12345.678) .fastCalc(type: FastCalcType.addition, amount: 1.111) .fastCalc(type: FastCalcType.substraction, amount: 2.222); print(fmf.output.nonSymbol); // 12,345.68 ``` -------------------------------- ### Monetary Value Comparison Source: https://pub.dev/packages/money_formatter/versions/0.0.1/example Illustrates how to compare a formatted monetary value against a given number using the isEqual method. This is helpful for checking equality in financial logic. ```dart fmf.comparator.isEqual(5000) ``` -------------------------------- ### Import MoneyFormatter Library Source: https://pub.dev/packages/money_formatter Import the necessary library to use the MoneyFormatter functionalities in your Flutter project. ```dart import 'package:flutter_money_formatter/flutter_money_formatter.dart'; ``` -------------------------------- ### Add money_formatter to pubspec.yaml Source: https://pub.dev/packages/money_formatter/versions/0.0.5/install This is how the money_formatter dependency will appear in your pubspec.yaml file after running the add command. ```yaml dependencies: money_formatter: ^0.0.5 ``` -------------------------------- ### MoneyFormatterSettings Configuration Source: https://pub.dev/packages/money_formatter The MoneyFormatterSettings class allows customization of how monetary values are formatted, including currency symbols, separators, and decimal precision. ```APIDOC ## MoneyFormatterSettings ### Configuration Properties - **symbol** (String) - Default: `$` - The currency symbol. - **thousandSeparator** (String) - Default: `,` - Character for thousand separation. - **decimalSeparator** (String) - Default: `.` - Character for decimal separation. - **fractionDigits** (int) - Default: `2` - Number of digits after the decimal point. - **symbolAndNumberSeparator** (String) - Default: `' '` - Separator between symbol and number. - **compactFormatType** (CompactFormatType) - Default: `CompactFormatType.short` - Type of compact format (short or long). ``` -------------------------------- ### CompactFormatType Options Source: https://pub.dev/packages/money_formatter/versions/0.0.7 Defines how compact monetary values are represented. ```APIDOC ## CompactFormatType ### Description Allows specifying the display style for compact number formats. ### Values - **short**: Used to make the compact format displayed using short text (e.g., 'M' for million). - **long**: Used to make the compact format displayed using long text (e.g., 'million'). ``` -------------------------------- ### MoneyFormatterCompare Methods Source: https://pub.dev/packages/money_formatter The MoneyFormatterCompare class offers methods to compare the current monetary amount against another value. ```APIDOC ## MoneyFormatterCompare ### Comparison Methods - **isLowerThan**(amount: double) - Returns true if the current amount is lower than the provided amount. - **isGreaterThan**(amount: double) - Returns true if the current amount is greater than the provided amount. - **isEqual**(amount: double) - Returns true if the current amount is equal to the provided amount. - **isEqualOrLowerThan**(amount: double) - Returns true if the current amount is equal to or lower than the provided amount. - **isEqualOrGreaterThan**(amount: double) - Returns true if the current amount is equal to or greater than the provided amount. ``` -------------------------------- ### Display Compact Long Format Source: https://pub.dev/packages/money_formatter/versions/0.0.3/example Shows how to display a large number in a long compact format without a symbol. Requires initializing MoneyFormatter with an amount. ```dart fmf.copyWith(amount: 12345678987654321.9012345).output.compactNonSymbol ``` -------------------------------- ### Money Formatter License Text Source: https://pub.dev/packages/money_formatter/license This is the full license text for the money_formatter package. It outlines the terms of use, modification, and distribution. ```text Copyright (c) 2019, Fadhly Permata All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. The views and conclusions contained in the software and documentation are those of the authors and should not be interpreted as representing official policies, either expressed or implied, of the FlutterMoneyFormatter project. ``` -------------------------------- ### MoneyFormatterCompare Methods Source: https://pub.dev/packages/money_formatter/versions/0.0.7 Compare the current MoneyFormatter instance's amount against another amount. ```APIDOC ## MoneyFormatterCompare ### Comparison Methods - **isLowerThan**(amount: double) - Returns `true` if the current instance's amount is lower than the provided amount, `false` otherwise. - **isGreaterThan**(amount: double) - Returns `true` if the current instance's amount is greater than the provided amount, `false` otherwise. - **isEqual**(amount: double) - Returns `true` if the current instance's amount is equal to the provided amount, `false` otherwise. - **isEqualOrLowerThan**(amount: double) - Returns `true` if the current instance's amount is equal to or lower than the provided amount, `false` otherwise. - **isEqualOrGreaterThan**(amount: double) - Returns `true` if the current instance's amount is equal to or greater than the provided amount, `false` otherwise. ### Example ```dart MoneyFormatter fmf = MoneyFormatter(amount: 12345678.9012345); double comparerValue = 5678.9012; print(fmf.comparator.isEqual(comparerValue)); // false print(fmf.comparator.isGreaterThan(comparerValue)); // true ``` ``` -------------------------------- ### Import money_formatter in Dart Code Source: https://pub.dev/packages/money_formatter/versions/0.0.1/install Use this import statement at the top of your Dart files to access the package's functionality. ```dart import 'package:money_formatter/money_formatter.dart'; ``` -------------------------------- ### Duplicating MoneyFormatter Instance Source: https://pub.dev/packages/money_formatter Illustrates how to duplicate a `MoneyFormatter` instance using `copyWith` and modify its symbol and separator, then accessing the formatted output. ```dart MoneyFormatter fmf = MoneyFormatter(amount: 12345678.9012345); print(fmf.output.symbolOnLeft); // $ 12,345,678.90 print(fmf.copyWith(symbol: 'IDR', symbolAndNumberSeparator: '-').output.symbolOnLeft); // IDR-12,345,678.90 ``` -------------------------------- ### MoneyFormatterOutput Formats Source: https://pub.dev/packages/money_formatter The MoneyFormatterOutput class provides various string representations of the formatted monetary value. ```APIDOC ## MoneyFormatterOutput ### Available Formats - **nonSymbol** (String) - Formatted number without currency symbol (e.g., 12,345,678.90). - **symbolOnLeft** (String) - Formatted number with currency symbol on the left (e.g., $ 12,345,678.90). - **symbolOnRight** (String) - Formatted number with currency symbol on the right (e.g., 12,345,678.90 $). - **compactNonSymbol** (String) - Compact formatted number without currency symbol (e.g., 12.3M). - **compactSymbolOnLeft** (String) - Compact formatted number with currency symbol on the left (e.g., $ 12.3M). - **compactSymbolOnRight** (String) - Compact formatted number with currency symbol on the right (e.g., 12.3M $). - **fractionDigitsOnly** (String) - Only the fractional part of the number (e.g., 90). - **withoutFractionDigits** (String) - The number without any fractional digits (e.g., 12,345,678). ``` -------------------------------- ### Compact Non-Symbol Formatting Source: https://pub.dev/packages/money_formatter/example Demonstrates how to format a large number into a compact string without a currency symbol, using the long compact format type. ```dart fmf.copyWith(amount: 12345678987654321.9012345, compactFormatType: CompactFormatType.long).output.compactNonSymbol ``` -------------------------------- ### Basic Money Formatting in Flutter Source: https://pub.dev/packages/money_formatter/versions/0.0.1/example This snippet shows how to initialize MoneyFormatter with an amount and display its default formatted outputs, including non-symbol, symbol on left, symbol on right, without decimals, and decimal only. ```dart import 'package:flutter/material.dart'; import 'package:money_formatter/money_formatter.dart'; void main() => runApp(MyApp()); class MyApp extends StatefulWidget { @override _MyAppState createState() => _MyAppState(); } class _MyAppState extends State { @override Widget build(BuildContext context) { TextStyle titleStyle = TextStyle(fontSize: 24.0, fontWeight: FontWeight.bold); TextStyle subtitleStyle = TextStyle(fontSize: 20.0); MoneyFormatter fmf = MoneyFormatter(amount: 12345678.9012345); MoneyFormatterOutput fo = fmf.output; return MaterialApp( home: Scaffold( appBar: AppBar( title: const Text('Money Formatter Demo'), ), body: SingleChildScrollView( child: ConstrainedBox( constraints: BoxConstraints(), child: Container( padding: EdgeInsets.all(15.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ ListTile( title: Text( 'FormattedNonSymbol :', style: titleStyle, ), subtitle: Text( fo.nonSymbol, style: subtitleStyle, ), ), ListTile( title: Text( 'FormattedLeftSymbol :', style: titleStyle, ), subtitle: Text( fo.symbolOnLeft, style: subtitleStyle, ), ), ListTile( title: Text( 'FormattedRightSymbol :', style: titleStyle, ), subtitle: Text( fo.symbolOnRight, style: subtitleStyle, ), ), ListTile( title: Text( 'FormattedWithoutDecimal :', style: titleStyle, ), subtitle: Text( fo.withoutFractionDigits, style: subtitleStyle, ), ), ListTile( title: Text( 'DecimalOnly :', style: titleStyle, ), subtitle: Text( fo.fractionDigitsOnly, style: subtitleStyle, ), ), ListTile( title: Text( 'FormattedNonSymbolCustom :', style: titleStyle, ), subtitle: Text( fmf .copyWith(amount: 123.4567, fractionDigits: 4) .output .nonSymbol, style: subtitleStyle, ), ), ListTile( title: Text( 'FormattedLeftSymbolCustom :', style: titleStyle, ), subtitle: Text( fmf .copyWith( symbol: 'IDR', symbolAndNumberSeparator: '-') .output .symbolOnLeft, style: subtitleStyle, ), ), ListTile( title: Text( 'CompactNonSymbol :', style: titleStyle, ), subtitle: Text( fmf .copyWith(amount: 12345678987654321.9012345) .output .compactNonSymbol, style: subtitleStyle, ), ), ListTile( title: Text( 'CompactLongNonSymbol :', style: titleStyle, ), subtitle: Text( fmf ``` -------------------------------- ### Compact Symbol on Left Formatting Source: https://pub.dev/packages/money_formatter/example Shows how to format a number with the currency symbol appearing to the left of the value. ```dart fmf.copyWith(amount: 1234.56789).output.compactSymbolOnLeft ``` -------------------------------- ### Display Compact Long Format Source: https://pub.dev/packages/money_formatter/versions/0.0.5/example Shows how to display a large number in a long compact format without a symbol. ```dart subtitle: Text( fmf .copyWith( amount: 12345678987654321.9012345, compactFormatType: CompactFormatType.long) .output .compactNonSymbol, style: subtitleStyle, ), ``` -------------------------------- ### MoneyFormatter Properties Source: https://pub.dev/packages/money_formatter The MoneyFormatter class has several properties that define the value to be formatted and its associated settings and output configurations. ```APIDOC ## MoneyFormatter ### Properties - **amount** (double) - Amount number that will be formatted. - **settings** (MoneyFormatterSettings) - Configuration for formatting. - **output** (MoneyFormatterOutput) - Specifies the desired output format. - **comparator** (MoneyFormatterCompare) - Provides methods for comparing monetary values. ``` -------------------------------- ### Compact Symbol on Right Formatting Source: https://pub.dev/packages/money_formatter/example Illustrates formatting a number with the currency symbol to the right of the value, using the short compact format type. ```dart fmf.copyWith(amount: 123456.7890, compactFormatType: CompactFormatType.short).output.compactSymbolOnRight ``` -------------------------------- ### CompactFormatType Options Source: https://pub.dev/packages/money_formatter Defines the type of compact formatting used for large numbers, such as millions or trillions. ```APIDOC ## CompactFormatType ### Options - **short**: Used for short text representation (e.g., 12.3M). - **long**: Used for long text representation (e.g., 12.3 million). ``` -------------------------------- ### Compact Format with Symbol on Left Source: https://pub.dev/packages/money_formatter/versions/0.0.6/example Formats a currency amount with the compact symbol positioned to the left of the number. ```dart subtitle: Text( fmf .copyWith(amount: 1234.56789) .output .compactSymbolOnLeft, style: subtitleStyle, ), ``` -------------------------------- ### Access Formatted Output via Assigned Variable Source: https://pub.dev/packages/money_formatter Retrieve formatted string representations using the previously assigned MoneyFormatterOutput variable. ```dart // normal form print(fo.nonSymbol); // 12,345,678.90 print(fo.symbolOnLeft); // $ 12,345,678.90 print(fo.symbolOnRight); // 12,345,678.90 $ print(fo.fractionDigitsOnly); // 90 print(fo.withoutFractionDigits); // 12,345,678 // compact form print(fo.compactNonSymbol) // 12.3M print(fo.compactLeftSymbol) // $ 12.3M print(fo.compactRightSymbol) // 12.3M $ ``` -------------------------------- ### Compare IsEqual Source: https://pub.dev/packages/money_formatter/versions/0.0.6/example Compares the current amount with a specified value to check for equality using the isEqual method. ```dart subtitle: Text( '${fmf.comparator.isEqual(5000)}', style: subtitleStyle, ) ``` -------------------------------- ### MoneyFormatter Function Signature Source: https://pub.dev/packages/money_formatter This is the function signature for `fastCalc` which performs various fast calculation processes. ```dart MoneyFormatter fastCalc({ @required FastCalcType type, @required double amount }) ``` -------------------------------- ### Assign Output to a Variable Source: https://pub.dev/packages/money_formatter Store the MoneyFormatterOutput object in a variable for easier and repeated access to formatted values. ```dart MoneyFormatterOutput fo = fmf.output; ``` -------------------------------- ### Default Clause Warning Source: https://pub.dev/packages/money_formatter/versions/0.0.6/score This code snippet highlights a warning related to a default clause in the analysis of the package. It indicates a potential issue in `lib/src/flutter_money_formatter_base.dart`. ```dart default: ``` -------------------------------- ### Wildcard Identifier Info Source: https://pub.dev/packages/money_formatter/score This snippet indicates an informational message about a referenced identifier being a wildcard. It is located in lib/src/flutter_money_formatter_base.dart. ```dart .map((_) => _.group(0)) ^ ``` -------------------------------- ### Default Clause Warning Source: https://pub.dev/packages/money_formatter/score This snippet highlights a default clause that is covered by previous cases in the code. It is located in lib/src/flutter_money_formatter_base.dart. ```dart default: ^^^^^^^^ ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.