Reviewed-on: #38 Co-authored-by: Florian Griffon <florian.griffon@epitech.eu> Co-committed-by: Florian Griffon <florian.griffon@epitech.eu>
27 lines
662 B
Dart
27 lines
662 B
Dart
import 'package:flutter/services.dart';
|
|
|
|
// Service to manage call-related operations
|
|
class CallService {
|
|
static const MethodChannel _channel = MethodChannel('call_service');
|
|
|
|
// Function to make a GSM call
|
|
Future<void> makeGsmCall(String phoneNumber) async {
|
|
try {
|
|
await _channel.invokeMethod('makeGsmCall', {"phoneNumber": phoneNumber});
|
|
} catch (e) {
|
|
print("Error making call: $e");
|
|
rethrow;
|
|
}
|
|
}
|
|
|
|
// Function to hang up the current call
|
|
Future<void> hangUpCall() async {
|
|
try {
|
|
await _channel.invokeMethod('hangUpCall');
|
|
} catch (e) {
|
|
print("Error hanging up call: $e");
|
|
rethrow;
|
|
}
|
|
}
|
|
}
|