syncModels method

dynamic syncModels(
  1. String jobName,
  2. BuildContext context,
  3. Function dispatcher, [
  4. List<Type>? models,
])

Implementation

syncModels(String jobName, BuildContext context, Function dispatcher,
    [List<Type>? models]) async {
  // fix BuildContext?, List<Type>?
  bool isNetworkAvilable = await SystemRF.network.hasInternet();
  if (isNetworkAvilable) {
    if (!Platform.isIOS) {
      var inputData = Map<String, dynamic>();
      if (models != null) {
        for (var item in models) {
          inputData[item.toString()] = item.toString();
        }
      }
      _syncWithService(jobName, context, dispatcher,
          models == null ? null : inputData); // pass table
    } else {
      _syncWithoutService(models!, context); // pass table
    }
  } else {
    rf.msg(context, 'No Internet Connection');
  }
}