initial import
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
import '../models/event_detail.dart';
|
||||
import '../services/api_service.dart';
|
||||
|
||||
class EventDetailProvider extends ChangeNotifier {
|
||||
final ApiService _apiService;
|
||||
|
||||
EventDetail? eventDetail;
|
||||
bool isLoading = false;
|
||||
String? error;
|
||||
|
||||
EventDetailProvider(this._apiService);
|
||||
|
||||
Future<void> loadEventDetail(String gameId, String account) async {
|
||||
isLoading = true;
|
||||
error = null;
|
||||
eventDetail = null;
|
||||
notifyListeners();
|
||||
|
||||
try {
|
||||
eventDetail = await _apiService.getGameDetail(gameId, account);
|
||||
isLoading = false;
|
||||
notifyListeners();
|
||||
} catch (e) {
|
||||
isLoading = false;
|
||||
error = 'Failed to load event details';
|
||||
notifyListeners();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user