showCurrencyPicker function Null safety

void showCurrencyPicker(
  1. {required BuildContext context,
  2. required ValueChanged<Currency> onSelect,
  3. List<String>? favorite,
  4. List<String>? currencyFilter,
  5. String? searchHint,
  6. bool showSearchField = true,
  7. bool showFlag = true,
  8. bool showCurrencyName = true,
  9. bool showCurrencyCode = true,
  10. ScrollPhysics? physics,
  11. CurrencyPickerThemeData? theme}
)

Show currency picker

onSelect: Called when a currency is select. The currency picker passes the new value to the callback (required) showFlag: Shows flag for each currency. Default value true (optional). searchHint: Option to customize hint of the search TextField (optional). showCurrencyName: Option to show/hide the currency name, default value true (optional). showCurrencyCode: Option to show/hide the currency code, default value true (optional). currencyFilter: Can be used to uses filter the Currency list (optional). favorite: The Currencies that will appear at the top of the list (optional). theme: can be used to customizing the country list bottom sheet (optional).

This example demonstrates how to use showCurrencyPicker

showCurrencyPicker(
   context: context,
   showFlag: true,
   showCurrencyName: true,
   showCurrencyCode: true,
   onSelect: (Currency currency) {
      print('Select currency: ${currency.name}');
   },
   currencyFilter: <String>['EUR', 'GBP', 'USD', 'AUD', 'CAD', 'JPY', 'HKD', 'CHF', 'SEK', 'ILS'],
);

Implementation

void showCurrencyPicker({
  required BuildContext context,
  required ValueChanged<Currency> onSelect,
  List<String>? favorite,
  List<String>? currencyFilter,
  String? searchHint,
  bool showSearchField = true,
  bool showFlag = true,
  bool showCurrencyName = true,
  bool showCurrencyCode = true,
  ScrollPhysics? physics,
  CurrencyPickerThemeData? theme,
}) {
  assert(
    showCurrencyName || showCurrencyCode,
    'showCurrencyName and showCurrencyCode cannot be both false',
  );
  currency_list.showCurrencyListBottomSheet(
    context: context,
    onSelect: onSelect,
    showSearchField: showSearchField,
    searchHint: searchHint,
    showFlag: showFlag,
    showCurrencyName: showCurrencyName,
    showCurrencyCode: showCurrencyCode,
    favorite: favorite,
    currencyFilter: currencyFilter,
    theme: theme,
    physics: physics,
  );
}