onDataSourceSuccess method

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

Implementation

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

    // clear options
    for (var option in options) {
      option.dispose();
    }
    options.clear();

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

    // set data
    await setData();

    // notify
    notifyListeners('options', options);
  }
  catch(e)
  {
    Log().error('Error building list. Error is $e', caller: 'CHECKBOX');
  }
  return true;
}