clearAllData method

Future<void> clearAllData({
  1. required dynamic clientRetailerId,
  2. required List imageFilePath,
})

Implementation

Future<void> clearAllData(
    {required clientRetailerId, required List imageFilePath}) async {
  // delete Image path from application directory:
  await ImageFunction.deleteImagePath(imageFilePath);

  // Clear db data:
  await DatabaseHelper.instance.deleteSpecificRow(
      tablename: ConstantName.formDetailsTable,
      whereArgsList: {
        ConstantName.clientRetailerId: clientRetailerId,
      });
  await DatabaseHelper.instance.deleteSpecificRow(
      tablename: ConstantName.formDependableTable,
      whereArgsList: {
        ConstantName.clientRetailerId: clientRetailerId,
      });
  await DatabaseHelper.instance.deleteSpecificRow(
      tablename: ConstantName.formApiTable,
      whereArgsList: {
        ConstantName.clientRetailerId: clientRetailerId,
      });
  await DatabaseHelper.instance.deleteSpecificRow(
      tablename: ConstantName.retailerIdTable,
      whereArgsList: {ConstantName.clientRetailerId: clientRetailerId});
  await DatabaseHelper.instance.deleteSpecificRow(
      tablename: ConstantName.uploadRetailerIdTable,
      whereArgsList: {ConstantName.clientRetailerId: clientRetailerId});

  await SharedPreferenceHelper.deleteStringValueByKey(
    SharedPreferenceKey.retailerID,
  );

  // clear cache data:
  clearUserDetails();
}