You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
cloudsolutions-atoms/lib/modules/signup/providers/group_provider.dart

33 lines
780 B
Dart

import 'package:test_sa/modules/signup/models/group_model.dart';
import 'package:test_sa/providers/loading_list_notifier.dart';
class GroupProvider extends LoadingListNotifier<Group> {
@override
Future getData({int? id}) async {
if (loading) return -2;
loading = true;
notifyListeners();
try {
// TODO: Replace with actual API call when available
await Future.delayed(const Duration(milliseconds: 500));
items = [
Group(code: 'HMG', displayName: 'HMG'),
Group(code: 'Non-HMG', displayName: 'Non-HMG'),
];
stateCode = 200;
loading = false;
notifyListeners();
return 200;
} catch (error) {
loading = false;
stateCode = -1;
notifyListeners();
return -1;
}
}
}