trigger method

  1. @override
Future<void> trigger({
  1. required BuildContext context,
  2. String position = initialPosition,
  3. String? userStatId = "",
  4. required String event,
  5. Map<String, dynamic>? gameSettingDetails,
})
override

Implementation

@override
Future<void> trigger({
  required BuildContext context,
  String position = initialPosition,
  String? userStatId = "",
  required String event,
  Map<String, dynamic>? gameSettingDetails,
}) async {
  print('HERE!!!!!!!!!!');

  Map<String, dynamic> getChallengesResponse = {};
  try {
    getChallengesResponse = await fetchChallenges(id, token);
  } catch (e) {
    print('Null Error: $e');
  }

  log('getChallengesResponse: ${getChallengesResponse["data"]}',
      name: 'ChallengesUi');
  late ChallengePageEntity? challengePageEntity;

  try {
    challengePageEntity = ChallengePageEntity.fromMap(
      getChallengesResponse,
    );
  } catch (e) {
    print('Null Error: $e');
  }

  Navigator.push(
    context,
    MaterialPageRoute(
      builder: (context) {
        return ChallengesPage(
          challengePageData: challengePageEntity!.data,
        );
      },
    ),
  );
}