KonectarEvents/lib/contacts_module/provider_class/affiliationsprovider.dart

47 lines
1.3 KiB
Dart

import 'dart:convert';
import 'package:konectar_events/contacts_module/service.dart/service.dart';
import 'package:konectar_events/contacts_module/storage_hive/aff_data/insert_aff.dart';
import 'package:flutter/cupertino.dart';
class AffiliationsProvider extends ChangeNotifier {
final affapi = Callapi();
List affiliations1 = [];
List allaffiliations1 = [];
List get adddta => affiliations1;
List get affiliationsAll => allaffiliations1;
getAffiliationsdata(text) async {
print("Affiliations_is: ${text}");
final affdata = await affapi.getaffiliationsdata(text);
print("Affiliations_is after:$affdata ");
// final Map<String, dynamic> jsonData = json.decode(affdata);
// // final List<dynamic> affiliations = jsonData['Affiliations'];
// print("Affiliations_is return:$jsonData ");
affiliations1 = affdata;
notifyListeners();
}
getAllAffiliationsdata() async {
print("Affiliations_is: ");
final affdata = await affapi.getallaffiliationsdata();
print("Affiliations_is after:$affdata ");
allaffiliations1 = affdata;
notifyListeners();
}
storeAff(row) async {
final affdata = await affapi.getaffiliationsdata(row);
print("Affiliations_MyStoringData:$affdata ");
await addAffiliation(affdata);
}
}