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.
26 lines
969 B
Dart
26 lines
969 B
Dart
|
3 years ago
|
import 'dart:convert';
|
||
|
|
|
||
|
|
import 'package:flutter/services.dart';
|
||
|
|
import 'package:logger/logger.dart' as L;
|
||
|
|
import 'package:mohem_flutter_app/models/marathon/marathon_model.dart';
|
||
|
|
import 'package:mohem_flutter_app/models/marathon/question_model.dart';
|
||
|
|
|
||
|
|
class DemoMarathonRepo {
|
||
|
|
L.Logger logger = L.Logger();
|
||
|
|
|
||
|
|
Future<MarathonDetailModel> getDemoMarathonDetails() async {
|
||
|
|
String response = await rootBundle.loadString('assets/json/demo_upcoming_marathon');
|
||
|
|
var json = jsonDecode(response);
|
||
|
|
MarathonDetailModel marathonDetailModel = MarathonDetailModel.fromJson(json);
|
||
|
|
return marathonDetailModel;
|
||
|
|
}
|
||
|
|
|
||
|
|
Future<QuestionModel> getDemoNextQuestion({required int currentQuestionNumber}) async {
|
||
|
|
String response = await rootBundle.loadString('assets/json/demo_questions_marathon');
|
||
|
|
List json = jsonDecode(response);
|
||
|
|
QuestionModel currentQuestion = QuestionModel.fromJson(json.elementAt(currentQuestionNumber));
|
||
|
|
|
||
|
|
return currentQuestion;
|
||
|
|
}
|
||
|
|
}
|