DiscoverModule/lib/provider_class/affiliationsprovider.dart

41 lines
1.2 KiB
Dart

import 'dart:convert';
import 'package:discover_module/model_class/affiliations.dart';
import 'package:discover_module/model_class/section.dart';
import 'package:discover_module/service.dart/service.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;
// print("Affiliations_is return:$affiliations1 ");
notifyListeners();
}
getAllAffiliationsdata() async {
print("Affiliations_is: ");
final affdata = await affapi.getallaffiliationsdata();
print("Affiliations_is after:$affdata ");
allaffiliations1 = affdata;
notifyListeners();
}
}