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.
car_common_app/lib/view_models/chat_view_model.dart

40 lines
1.2 KiB
Dart

import 'package:flutter/cupertino.dart';
import 'package:mc_common_app/repositories/chat_repo.dart';
import 'package:mc_common_app/utils/utils.dart';
import 'package:signalr_netcore/hub_connection.dart';
class ChatVM extends ChangeNotifier {
final ChatRepo chatRepo;
ChatVM({required this.chatRepo});
HubConnection? hubConnection;
Future<void> buildHubConnection() async {
hubConnection = await chatRepo.buildChatHubConnection();
notifyListeners();
}
Future<void> onSendMessageForRequestOffer() async {
if (hubConnection == null || hubConnection!.state != HubConnectionState.Connected) {
await buildHubConnection();
}
if (hubConnection != null) {
hubConnection!.invoke(
"SendMessageRequestOffer",
args: <Object>[
// <String, dynamic>{
// "employeeNumber": AppState().memberInformationList!.eMPLOYEENUMBER ?? "",
// "employeeName": AppState().memberInformationList!.eMPLOYEENAME ?? "",
// "marathonId": AppState().getMarathonProjectId,
// "prizeId": "8577B2E8-5DD7-43F0-10DD-08DACB0AC064",
// }
],
).catchError((e) {
Utils.showToast(e.toString());
return null;
});
}
}
}