onDataSourceSuccess method

  1. @override
Future<bool> onDataSourceSuccess(
  1. IDataSource source,
  2. Data? list
)
override

Implementation

@override
Future<bool> onDataSourceSuccess(IDataSource source, Data? list) async {
  try {
    if (prototype == null) return true;

    // clear options
    _clearOptions();

    // build options
    list?.forEach((row) {
      OptionModel? model = OptionModel.fromXml(this, prototype, data: row);
      if (model != null) options.add(model);
    });

    // set selected option
    _setSelectedOption();
  } catch (e) {
    Log().error('Error building list. Error is $e', caller: 'RADIO');
  }
  return true;
}