DiscoverModule/lib/contacts_module/provider_class/affiliationsprovider.dart

47 lines
1.3 KiB
Dart
Raw Permalink Normal View History

2024-08-30 12:24:54 +00:00
import 'dart:convert';
2024-10-07 12:41:28 +00:00
import 'package:discover_module/contacts_module/service.dart/service.dart';
import 'package:discover_module/contacts_module/storage_hive/aff_data/insert_aff.dart';
2024-07-05 08:48:29 +00:00
import 'package:flutter/cupertino.dart';
class AffiliationsProvider extends ChangeNotifier {
final affapi = Callapi();
List affiliations1 = [];
List allaffiliations1 = [];
List get adddta => affiliations1;
List get affiliationsAll => allaffiliations1;
2024-08-30 12:24:54 +00:00
getAffiliationsdata(text) async {
print("Affiliations_is: ${text}");
final affdata = await affapi.getaffiliationsdata(text);
2024-07-05 08:48:29 +00:00
print("Affiliations_is after:$affdata ");
2024-08-30 12:24:54 +00:00
// final Map<String, dynamic> jsonData = json.decode(affdata);
// // final List<dynamic> affiliations = jsonData['Affiliations'];
// print("Affiliations_is return:$jsonData ");
2024-07-05 08:48:29 +00:00
affiliations1 = affdata;
2024-08-30 12:24:54 +00:00
2024-07-05 08:48:29 +00:00
notifyListeners();
}
getAllAffiliationsdata() async {
print("Affiliations_is: ");
final affdata = await affapi.getallaffiliationsdata();
print("Affiliations_is after:$affdata ");
allaffiliations1 = affdata;
notifyListeners();
}
2024-10-07 12:41:28 +00:00
storeAff(row) async {
final affdata = await affapi.getaffiliationsdata(row);
print("Affiliations_MyStoringData:$affdata ");
await addAffiliation(affdata);
}
2024-07-05 08:48:29 +00:00
}