diff --git a/lib/client/base_app_client.dart b/lib/client/base_app_client.dart index 0218507f..f06c3930 100644 --- a/lib/client/base_app_client.dart +++ b/lib/client/base_app_client.dart @@ -1,5 +1,3 @@ -//@dart=2.9 - import 'dart:convert'; import 'dart:io' show Platform; @@ -24,9 +22,9 @@ Utils helpers = new Utils(); class BaseAppClient { //TODO change the post fun to nun static when you change all service post(String endPoint, - {Map body, - Function(dynamic response, int statusCode) onSuccess, - Function(String error, int statusCode) onFailure, + {required Map body, + required Function(dynamic response, int statusCode) onSuccess, + required Function(String error, int statusCode) onFailure, bool isAllowAny = false, bool isLiveCare = false, bool isFallLanguage = false}) async { @@ -38,25 +36,23 @@ class BaseAppClient { bool callLog = true; try { - Map profile = await sharedPref.getObj(DOCTOR_PROFILE); + Map? profile = await sharedPref.getObj(DOCTOR_PROFILE); String token = await sharedPref.getString(TOKEN); if (profile != null) { DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); if (body['DoctorID'] == null) { - body['DoctorID'] = doctorProfile?.doctorID; + body['DoctorID'] = doctorProfile.doctorID; } if (body['DoctorID'] == "") body['DoctorID'] = null; - if (body['EditedBy'] == null) - body['EditedBy'] = doctorProfile?.doctorID; + if (body['EditedBy'] == null) body['EditedBy'] = doctorProfile.doctorID; if (body['ProjectID'] == null) { - body['ProjectID'] = doctorProfile?.projectID; + body['ProjectID'] = doctorProfile.projectID; } - if (body['ClinicID'] == null) - body['ClinicID'] = doctorProfile?.clinicID; + if (body['ClinicID'] == null) body['ClinicID'] = doctorProfile.clinicID; } else { - String doctorID = await sharedPref.getString(DOCTOR_ID); + String? doctorID = await sharedPref.getString(DOCTOR_ID); if (body['DoctorID'] == '') { body['DoctorID'] = null; } else if (doctorID != null) body['DoctorID'] = int.parse(doctorID); @@ -70,7 +66,7 @@ class BaseAppClient { } if (!isFallLanguage) { - String lang = await sharedPref.getString(APP_Language); + String? lang = await sharedPref.getString(APP_Language); if (lang != null && lang == 'ar') body['LanguageID'] = 1; else @@ -88,21 +84,16 @@ class BaseAppClient { body['IsLoginForDoctorApp'] = IS_LOGIN_FOR_DOCTOR_APP; body['PatientOutSA'] = body['PatientOutSA'] ?? 0; // PATIENT_OUT_SA; if (body['VidaAuthTokenID'] == null) { - body['VidaAuthTokenID'] = - await sharedPref.getString(VIDA_AUTH_TOKEN_ID); + body['VidaAuthTokenID'] = await sharedPref.getString(VIDA_AUTH_TOKEN_ID); } if (body['VidaRefreshTokenID'] == null) { - body['VidaRefreshTokenID'] = - await sharedPref.getString(VIDA_REFRESH_TOKEN_ID); + body['VidaRefreshTokenID'] = await sharedPref.getString(VIDA_REFRESH_TOKEN_ID); } int projectID = await sharedPref.getInt(PROJECT_ID); if (projectID == 2 || projectID == 3) body['PatientOutSA'] = true; - else if ((body.containsKey('facilityId') && body['facilityId'] == 2 || - body['facilityId'] == 3) || - body['ProjectID'] == 2 || - body['ProjectID'] == 3) + else if ((body.containsKey('facilityId') && body['facilityId'] == 2 || body['facilityId'] == 3) || body['ProjectID'] == 2 || body['ProjectID'] == 3) body['PatientOutSA'] = true; else body['PatientOutSA'] = false; @@ -113,29 +104,21 @@ class BaseAppClient { var asd = json.encode(body); var asd2; if (await Utils.checkConnection()) { - final response = await http.post(Uri.parse(url), - body: json.encode(body), - headers: { - 'Content-Type': 'application/json', - 'Accept': 'application/json' - }); + final response = await http.post(Uri.parse(url), body: json.encode(body), headers: {'Content-Type': 'application/json', 'Accept': 'application/json'}); final int statusCode = response.statusCode; if (statusCode < 200 || statusCode >= 400) { onFailure(Utils.generateContactAdminMsg(), statusCode); } else { var parsed = json.decode(response.body.toString()); if (parsed['ErrorType'] == 4) { - helpers.navigateToUpdatePage(parsed['ErrorEndUserMessage'], - parsed['AndroidLink'], parsed['IOSLink']); + helpers.navigateToUpdatePage(parsed['ErrorEndUserMessage'], parsed['AndroidLink'], parsed['IOSLink']); } if (parsed['IsAuthenticated'] != null && !parsed['IsAuthenticated']) { if (body['OTP_SendType'] != null) { onFailure(getError(parsed), statusCode); } else if (!isAllowAny) { - await Provider.of(AppGlobal.CONTEX, - listen: false) - .logout(); + await Provider.of(AppGlobal.CONTEX, listen: false).logout(); Utils.showErrorToast('Your session expired Please login again'); locator().pushNamedAndRemoveUntil(ROOT); @@ -162,30 +145,26 @@ class BaseAppClient { } postPatient(String endPoint, - {Map body, - Function(dynamic response, int statusCode) onSuccess, - Function(String error, int statusCode) onFailure, - @required PatiantInformtion patient, + {required Map body, + required Function(dynamic response, int statusCode) onSuccess, + required Function(String error, int statusCode) onFailure, + required PatiantInformtion patient, bool isExternal = false}) async { String url = BASE_URL + endPoint; try { - Map headers = { - 'Content-Type': 'application/json', - 'Accept': 'application/json' - }; + Map headers = {'Content-Type': 'application/json', 'Accept': 'application/json'}; String token = await sharedPref.getString(TOKEN); - Map profile = await sharedPref.getObj(DOCTOR_PROFILE); + Map? profile = await sharedPref.getObj(DOCTOR_PROFILE); if (profile != null) { DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); if (body['DoctorID'] == null) { - body['DoctorID'] = doctorProfile?.doctorID; + body['DoctorID'] = doctorProfile.doctorID; } } - var languageID = - await sharedPref.getStringWithDefaultValue(APP_Language, 'en'); + var languageID = await sharedPref.getStringWithDefaultValue(APP_Language, 'en'); body['SetupID'] = body.containsKey('SetupID') ? body['SetupID'] != null ? body['SetupID'] @@ -205,12 +184,11 @@ class BaseAppClient { : PATIENT_OUT_SA_PATIENT_REQ; if (body.containsKey('isDentalAllowedBackend')) { - body['isDentalAllowedBackend'] = - body.containsKey('isDentalAllowedBackend') - ? body['isDentalAllowedBackend'] != null - ? body['isDentalAllowedBackend'] - : IS_DENTAL_ALLOWED_BACKEND - : IS_DENTAL_ALLOWED_BACKEND; + body['isDentalAllowedBackend'] = body.containsKey('isDentalAllowedBackend') + ? body['isDentalAllowedBackend'] != null + ? body['isDentalAllowedBackend'] + : IS_DENTAL_ALLOWED_BACKEND + : IS_DENTAL_ALLOWED_BACKEND; } body['DeviceTypeID'] = Platform.isAndroid ? 1 : 2; @@ -231,10 +209,8 @@ class BaseAppClient { : PATIENT_TYPE_ID : PATIENT_TYPE_ID; - body['TokenID'] = body.containsKey('TokenID') ? body['TokenID']??token : token; - body['PatientID'] = body['PatientID'] != null - ? body['PatientID'] - : patient.patientId ?? patient.patientMRN; + body['TokenID'] = body.containsKey('TokenID') ? body['TokenID'] ?? token : token; + body['PatientID'] = body['PatientID'] != null ? body['PatientID'] : patient.patientId ?? patient.patientMRN; body['PatientOutSA'] = 0; //user['OutSA']; //TODO change it body['SessionID'] = SESSION_ID; //getSe @@ -247,11 +223,8 @@ class BaseAppClient { print("URL : $url"); print("Body : ${json.encode(body)}"); - var asd = json.encode(body); - var asd2; if (await Utils.checkConnection()) { - final response = await http.post(Uri.parse(url.trim()), - body: json.encode(body), headers: headers); + final response = await http.post(Uri.parse(url.trim()), body: json.encode(body), headers: headers); final int statusCode = response.statusCode; print("statusCode :$statusCode"); if (statusCode < 200 || statusCode >= 400 || json == null) { @@ -263,8 +236,7 @@ class BaseAppClient { onSuccess(parsed, statusCode); } else { if (parsed['ErrorType'] == 4) { - helpers.navigateToUpdatePage(parsed['ErrorEndUserMessage'], - parsed['AndroidLink'], parsed['IOSLink']); + helpers.navigateToUpdatePage(parsed['ErrorEndUserMessage'], parsed['AndroidLink'], parsed['IOSLink']); } if (parsed['IsAuthenticated'] == null) { if (parsed['isSMSSent'] == true) { @@ -280,28 +252,20 @@ class BaseAppClient { onFailure(getError(parsed), statusCode); } } - } else if (parsed['MessageStatus'] == 1 || - parsed['SMSLoginRequired'] == true) { + } else if (parsed['MessageStatus'] == 1 || parsed['SMSLoginRequired'] == true) { onSuccess(parsed, statusCode); - } else if (parsed['MessageStatus'] == 2 && - parsed['IsAuthenticated']) { + } else if (parsed['MessageStatus'] == 2 && parsed['IsAuthenticated']) { if (parsed['SameClinicApptList'] != null) { onSuccess(parsed, statusCode); } else { - if (parsed['message'] == null && - parsed['ErrorEndUserMessage'] == null) { + if (parsed['message'] == null && parsed['ErrorEndUserMessage'] == null) { if (parsed['ErrorSearchMsg'] == null) { - onFailure("Server Error found with no available message", - statusCode); + onFailure("Server Error found with no available message", statusCode); } else { onFailure(parsed['ErrorSearchMsg'], statusCode); } } else { - onFailure( - parsed['message'] ?? - parsed['ErrorEndUserMessage'] ?? - parsed['ErrorMessage'], - statusCode); + onFailure(parsed['message'] ?? parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], statusCode); } } } else { @@ -311,9 +275,7 @@ class BaseAppClient { if (parsed['message'] != null) { onFailure(parsed['message'] ?? parsed['message'], statusCode); } else { - onFailure( - parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], - statusCode); + onFailure(parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], statusCode); } } } @@ -334,14 +296,9 @@ class BaseAppClient { if (parsed["ValidationErrors"] != null) { error = parsed["ValidationErrors"]["StatusMessage"].toString() + "\n"; - if (parsed["ValidationErrors"]["ValidationErrors"] != null && - parsed["ValidationErrors"]["ValidationErrors"].length != 0) { - for (var i = 0; - i < parsed["ValidationErrors"]["ValidationErrors"].length; - i++) { - error = error + - parsed["ValidationErrors"]["ValidationErrors"][i]["Messages"][0] + - "\n"; + if (parsed["ValidationErrors"]["ValidationErrors"] != null && parsed["ValidationErrors"]["ValidationErrors"].length != 0) { + for (var i = 0; i < parsed["ValidationErrors"]["ValidationErrors"].length; i++) { + error = error + parsed["ValidationErrors"]["ValidationErrors"][i]["Messages"][0] + "\n"; } } } diff --git a/lib/config/size_config.dart b/lib/config/size_config.dart index f131d30a..b7b98101 100644 --- a/lib/config/size_config.dart +++ b/lib/config/size_config.dart @@ -5,15 +5,15 @@ class SizeConfig { static double _blockWidth = 0; static double _blockHeight = 0; - static double realScreenWidth; - static double realScreenHeight; - static double screenWidth; - static double screenHeight; - static double textMultiplier; - static double imageSizeMultiplier; - static double heightMultiplier; + static double? realScreenWidth; + static double? realScreenHeight; + static double? screenWidth; + static double? screenHeight; + static double? textMultiplier; + static double? imageSizeMultiplier; + static double? heightMultiplier; static bool isPortrait = true; - static double widthMultiplier; + static double? widthMultiplier; static bool isMobilePortrait = false; static bool isMobile = false; static bool isHeightShort = false; @@ -44,7 +44,7 @@ class SizeConfig { if (orientation == Orientation.portrait) { isPortrait = true; - if (realScreenWidth < 450) { + if (realScreenWidth! < 450) { isMobilePortrait = true; } // textMultiplier = _blockHeight; @@ -59,8 +59,8 @@ class SizeConfig { screenHeight = realScreenWidth; screenWidth = realScreenHeight; } - _blockWidth = screenWidth / 100; - _blockHeight = screenHeight / 100; + _blockWidth = screenWidth! / 100; + _blockHeight = screenHeight! / 100; textMultiplier = _blockHeight; imageSizeMultiplier = _blockWidth; @@ -77,7 +77,7 @@ class SizeConfig { print('isMobilePortrait $isMobilePortrait'); } - static getTextMultiplierBasedOnWidth({double width}) { + static getTextMultiplierBasedOnWidth({double? width}) { // TODO handel LandScape case if (width != null) { return width / 100; @@ -85,7 +85,7 @@ class SizeConfig { return widthMultiplier; } - static getWidthMultiplier({double width}) { + static getWidthMultiplier({double? width}) { // TODO handel LandScape case if (width != null) { return width / 100; @@ -93,7 +93,7 @@ class SizeConfig { return widthMultiplier; } - static getHeightMultiplier({double height}) { + static getHeightMultiplier({double? height}) { // TODO handel LandScape case if (height != null) { return height / 100; diff --git a/lib/core/model/ER_sign_in/doctor_ER_sign_assessment_req_model.dart b/lib/core/model/ER_sign_in/doctor_ER_sign_assessment_req_model.dart index 19996bd4..e1246086 100644 --- a/lib/core/model/ER_sign_in/doctor_ER_sign_assessment_req_model.dart +++ b/lib/core/model/ER_sign_in/doctor_ER_sign_assessment_req_model.dart @@ -1,8 +1,8 @@ class DoctorErSignAssessmentReqModel { - String setupID; - int signInType; - int loginDoctorID; - int patientID; + String? setupID; + int? signInType; + int? loginDoctorID; + int? patientID; DoctorErSignAssessmentReqModel( {this.setupID, this.signInType, this.loginDoctorID, this.patientID}); diff --git a/lib/core/model/admissionRequest/admission-request.dart b/lib/core/model/admissionRequest/admission-request.dart index 1ab5a990..d88d9c87 100644 --- a/lib/core/model/admissionRequest/admission-request.dart +++ b/lib/core/model/admissionRequest/admission-request.dart @@ -1,200 +1,190 @@ class AdmissionRequest { - int patientMRN; - int admitToClinic; - bool isPregnant; - int pregnancyWeeks; - int pregnancyType; - int noOfBabies; - int mrpDoctorID; - String admissionDate; - int expectedDays; - int admissionType; - int admissionLocationID; - int roomCategoryID; - int wardID; - bool isSickLeaveRequired; - String sickLeaveComments; - bool isTransport; - String transportComments; - bool isPhysioAppointmentNeeded; - String physioAppointmentComments; - bool isOPDFollowupAppointmentNeeded; - String opdFollowUpComments; - bool isDietType; - int dietType; - String dietRemarks; - bool isPhysicalActivityModification; - String physicalActivityModificationComments; - int orStatus; - String mainLineOfTreatment; - int estimatedCost; - String elementsForImprovement; - bool isPackagePatient; - String complications; - String otherDepartmentInterventions; - String otherProcedures; - String pastMedicalHistory; - String pastSurgicalHistory; - List admissionRequestDiagnoses; - List admissionRequestProcedures; - int appointmentNo; - int episodeID; - int admissionRequestNo; + int? patientMRN; + int? admitToClinic; + bool? isPregnant; + int? pregnancyWeeks; + int? pregnancyType; + int? noOfBabies; + int? mrpDoctorID; + String? admissionDate; + int? expectedDays; + int? admissionType; + int? admissionLocationID; + int? roomCategoryID; + int? wardID; + bool? isSickLeaveRequired; + String? sickLeaveComments; + bool? isTransport; + String? transportComments; + bool? isPhysioAppointmentNeeded; + String? physioAppointmentComments; + bool? isOPDFollowupAppointmentNeeded; + String? opdFollowUpComments; + bool? isDietType; + int? dietType; + String? dietRemarks; + bool? isPhysicalActivityModification; + String? physicalActivityModificationComments; + int? orStatus; + String? mainLineOfTreatment; + int? estimatedCost; + String? elementsForImprovement; + bool? isPackagePatient; + String? complications; + String? otherDepartmentInterventions; + String? otherProcedures; + String? pastMedicalHistory; + String? pastSurgicalHistory; + List? admissionRequestDiagnoses; + List? admissionRequestProcedures; + int? appointmentNo; + int? episodeID; + int? admissionRequestNo; - AdmissionRequest( - {this.patientMRN, - this.admitToClinic, - this.isPregnant, - this.pregnancyWeeks = 0, - this.pregnancyType = 0, - this.noOfBabies = 0, - this.mrpDoctorID, - this.admissionDate, - this.expectedDays, - this.admissionType, - this.admissionLocationID = 0, - this.roomCategoryID = 0, - this.wardID, - this.isSickLeaveRequired, - this.sickLeaveComments = "", - this.isTransport = false, - this.transportComments = "", - this.isPhysioAppointmentNeeded = false, - this.physioAppointmentComments = "", - this.isOPDFollowupAppointmentNeeded = false, - this.opdFollowUpComments = "", - this.isDietType, - this.dietType, - this.dietRemarks, - this.isPhysicalActivityModification = false, - this.physicalActivityModificationComments = "", - this.orStatus = 1, - this.mainLineOfTreatment, - this.estimatedCost, - this.elementsForImprovement, - this.isPackagePatient = false, - this.complications = "", - this.otherDepartmentInterventions = "", - this.otherProcedures = "", - this.pastMedicalHistory = "", - this.pastSurgicalHistory = "", - this.admissionRequestDiagnoses, - this.admissionRequestProcedures, - this.appointmentNo, - this.episodeID, - this.admissionRequestNo}); + AdmissionRequest({ + this.patientMRN, + this.admitToClinic, + this.isPregnant, + this.pregnancyWeeks, + this.pregnancyType, + this.noOfBabies, + this.mrpDoctorID, + this.admissionDate, + this.expectedDays, + this.admissionType, + this.admissionLocationID, + this.roomCategoryID, + this.wardID, + this.isSickLeaveRequired, + this.sickLeaveComments, + this.isTransport, + this.transportComments, + this.isPhysioAppointmentNeeded, + this.physioAppointmentComments, + this.isOPDFollowupAppointmentNeeded, + this.opdFollowUpComments, + this.isDietType, + this.dietType, + this.dietRemarks, + this.isPhysicalActivityModification, + this.physicalActivityModificationComments, + this.orStatus, + this.mainLineOfTreatment, + this.estimatedCost, + this.elementsForImprovement, + this.isPackagePatient, + this.complications, + this.otherDepartmentInterventions, + this.otherProcedures, + this.pastMedicalHistory, + this.pastSurgicalHistory, + this.admissionRequestDiagnoses, + this.admissionRequestProcedures, + this.appointmentNo, + this.episodeID, + this.admissionRequestNo, + }); - AdmissionRequest.fromJson(Map json) { - patientMRN = json['patientMRN']; - admitToClinic = json['admitToClinic']; - isPregnant = json['isPregnant']; - pregnancyWeeks = json['pregnancyWeeks']; - pregnancyType = json['pregnancyType']; - noOfBabies = json['noOfBabies']; - mrpDoctorID = json['mrpDoctorID']; - admissionDate = json['admissionDate']; - expectedDays = json['expectedDays']; - admissionType = json['admissionType']; - admissionLocationID = json['admissionLocationID']; - roomCategoryID = json['roomCategoryID']; - wardID = json['wardID']; - isSickLeaveRequired = json['isSickLeaveRequired']; - sickLeaveComments = json['sickLeaveComments']; - isTransport = json['isTransport']; - transportComments = json['transportComments']; - isPhysioAppointmentNeeded = json['isPhysioAppointmentNeeded']; - physioAppointmentComments = json['physioAppointmentComments']; - isOPDFollowupAppointmentNeeded = json['isOPDFollowupAppointmentNeeded']; - opdFollowUpComments = json['opdFollowUpComments']; - isDietType = json['isDietType']; - dietType = json['dietType']; - dietRemarks = json['dietRemarks']; - isPhysicalActivityModification = json['isPhysicalActivityModification']; - physicalActivityModificationComments = - json['physicalActivityModificationComments']; - orStatus = json['orStatus']; - mainLineOfTreatment = json['mainLineOfTreatment']; - estimatedCost = json['estimatedCost']; - elementsForImprovement = json['elementsForImprovement']; - isPackagePatient = json['isPackagePatient']; - complications = json['complications']; - otherDepartmentInterventions = json['otherDepartmentInterventions']; - otherProcedures = json['otherProcedures']; - pastMedicalHistory = json['pastMedicalHistory']; - pastSurgicalHistory = json['pastSurgicalHistory']; - if (json['admissionRequestDiagnoses'] != null) { - admissionRequestDiagnoses = new List(); - json['admissionRequestDiagnoses'].forEach((v) { - admissionRequestDiagnoses.add(v); - // admissionRequestDiagnoses - // .add(new AdmissionRequestDiagnoses.fromJson(v)); - }); + AdmissionRequest.fromJson(Map? json) { + if (json != null) { + patientMRN = json['patientMRN']; + admitToClinic = json['admitToClinic']; + isPregnant = json['isPregnant']; + pregnancyWeeks = json['pregnancyWeeks']; + pregnancyType = json['pregnancyType']; + noOfBabies = json['noOfBabies']; + mrpDoctorID = json['mrpDoctorID']; + admissionDate = json['admissionDate']; + expectedDays = json['expectedDays']; + admissionType = json['admissionType']; + admissionLocationID = json['admissionLocationID']; + roomCategoryID = json['roomCategoryID']; + wardID = json['wardID']; + isSickLeaveRequired = json['isSickLeaveRequired']; + sickLeaveComments = json['sickLeaveComments']; + isTransport = json['isTransport']; + transportComments = json['transportComments']; + isPhysioAppointmentNeeded = json['isPhysioAppointmentNeeded']; + physioAppointmentComments = json['physioAppointmentComments']; + isOPDFollowupAppointmentNeeded = json['isOPDFollowupAppointmentNeeded']; + opdFollowUpComments = json['opdFollowUpComments']; + isDietType = json['isDietType']; + dietType = json['dietType']; + dietRemarks = json['dietRemarks']; + isPhysicalActivityModification = + json['isPhysicalActivityModification']; + physicalActivityModificationComments = + json['physicalActivityModificationComments']; + orStatus = json['orStatus']; + mainLineOfTreatment = json['mainLineOfTreatment']; + estimatedCost = json['estimatedCost']; + elementsForImprovement = json['elementsForImprovement']; + isPackagePatient = json['isPackagePatient']; + complications = json['complications']; + otherDepartmentInterventions = json['otherDepartmentInterventions']; + otherProcedures = json['otherProcedures']; + pastMedicalHistory = json['pastMedicalHistory']; + pastSurgicalHistory = json['pastSurgicalHistory']; + if (json['admissionRequestDiagnoses'] != null) { + admissionRequestDiagnoses = List.from( + json['admissionRequestDiagnoses'], + ); + } + if (json['admissionRequestProcedures'] != null) { + admissionRequestProcedures = List.from( + json['admissionRequestProcedures'], + ); + } + appointmentNo = json['appointmentNo']; + episodeID = json['episodeID']; + admissionRequestNo = json['admissionRequestNo']; } - if (json['admissionRequestProcedures'] != null) { - admissionRequestProcedures = new List(); - json['admissionRequestProcedures'].forEach((v) { - admissionRequestProcedures.add(v); - // admissionRequestProcedures - // .add(new AdmissionRequestProcedures.fromJson(v)); - }); - } - appointmentNo = json['appointmentNo']; - episodeID = json['episodeID']; - admissionRequestNo = json['admissionRequestNo']; } Map toJson() { - final Map data = new Map(); - data['patientMRN'] = this.patientMRN; - data['admitToClinic'] = this.admitToClinic; - data['isPregnant'] = this.isPregnant; - data['pregnancyWeeks'] = this.pregnancyWeeks; - data['pregnancyType'] = this.pregnancyType; - data['noOfBabies'] = this.noOfBabies; - data['mrpDoctorID'] = this.mrpDoctorID; - data['admissionDate'] = this.admissionDate; - data['expectedDays'] = this.expectedDays; - data['admissionType'] = this.admissionType; - data['admissionLocationID'] = this.admissionLocationID; - data['roomCategoryID'] = this.roomCategoryID; - data['wardID'] = this.wardID; - data['isSickLeaveRequired'] = this.isSickLeaveRequired; - data['sickLeaveComments'] = this.sickLeaveComments; - data['isTransport'] = this.isTransport; - data['transportComments'] = this.transportComments; - data['isPhysioAppointmentNeeded'] = this.isPhysioAppointmentNeeded; - data['physioAppointmentComments'] = this.physioAppointmentComments; - data['isOPDFollowupAppointmentNeeded'] = - this.isOPDFollowupAppointmentNeeded; - data['opdFollowUpComments'] = this.opdFollowUpComments; - data['isDietType'] = this.isDietType; - data['dietType'] = this.dietType; - data['dietRemarks'] = this.dietRemarks; - data['isPhysicalActivityModification'] = - this.isPhysicalActivityModification; + final Map data = {}; + data['patientMRN'] = patientMRN; + data['admitToClinic'] = admitToClinic; + data['isPregnant'] = isPregnant; + data['pregnancyWeeks'] = pregnancyWeeks; + data['pregnancyType'] = pregnancyType; + data['noOfBabies'] = noOfBabies; + data['mrpDoctorID'] = mrpDoctorID; + data['admissionDate'] = admissionDate; + data['expectedDays'] = expectedDays; + data['admissionType'] = admissionType; + data['admissionLocationID'] = admissionLocationID; + data['roomCategoryID'] = roomCategoryID; + data['wardID'] = wardID; + data['isSickLeaveRequired'] = isSickLeaveRequired; + data['sickLeaveComments'] = sickLeaveComments; + data['isTransport'] = isTransport; + data['transportComments'] = transportComments; + data['isPhysioAppointmentNeeded'] = isPhysioAppointmentNeeded; + data['physioAppointmentComments'] = physioAppointmentComments; + data['isOPDFollowupAppointmentNeeded'] = isOPDFollowupAppointmentNeeded; + data['opdFollowUpComments'] = opdFollowUpComments; + data['isDietType'] = isDietType; + data['dietType'] = dietType; + data['dietRemarks'] = dietRemarks; + data['isPhysicalActivityModification'] = isPhysicalActivityModification; data['physicalActivityModificationComments'] = - this.physicalActivityModificationComments; - data['orStatus'] = this.orStatus; - data['mainLineOfTreatment'] = this.mainLineOfTreatment; - data['estimatedCost'] = this.estimatedCost; - data['elementsForImprovement'] = this.elementsForImprovement; - data['isPackagePatient'] = this.isPackagePatient; - data['complications'] = this.complications; - data['otherDepartmentInterventions'] = this.otherDepartmentInterventions; - data['otherProcedures'] = this.otherProcedures; - data['pastMedicalHistory'] = this.pastMedicalHistory; - data['pastSurgicalHistory'] = this.pastSurgicalHistory; - if (this.admissionRequestDiagnoses != null) { - data['admissionRequestDiagnoses'] = this.admissionRequestDiagnoses; - // this.admissionRequestDiagnoses.map((v) => v.toJson()).toList(); - } - if (this.admissionRequestProcedures != null) { - data['admissionRequestProcedures'] = - this.admissionRequestProcedures.map((v) => v.toJson()).toList(); - } - data['appointmentNo'] = this.appointmentNo; - data['episodeID'] = this.episodeID; - data['admissionRequestNo'] = this.admissionRequestNo; + physicalActivityModificationComments; + data['orStatus'] = orStatus; + data['mainLineOfTreatment'] = mainLineOfTreatment; + data['estimatedCost'] = estimatedCost; + data['elementsForImprovement'] = elementsForImprovement; + data['isPackagePatient'] = isPackagePatient; + data['complications'] = complications; + data['otherDepartmentInterventions'] = otherDepartmentInterventions; + data['otherProcedures'] = otherProcedures; + data['pastMedicalHistory'] = pastMedicalHistory; + data['pastSurgicalHistory'] = pastSurgicalHistory; + data['admissionRequestDiagnoses'] = admissionRequestDiagnoses; + data['admissionRequestProcedures'] = admissionRequestProcedures; + data['appointmentNo'] = appointmentNo; + data['episodeID'] = episodeID; + data['admissionRequestNo'] = admissionRequestNo; return data; } } diff --git a/lib/core/model/admissionRequest/clinic-model.dart b/lib/core/model/admissionRequest/clinic-model.dart index 3905e67b..a3722bae 100644 --- a/lib/core/model/admissionRequest/clinic-model.dart +++ b/lib/core/model/admissionRequest/clinic-model.dart @@ -1,32 +1,35 @@ class Clinic { - int clinicGroupID; - String clinicGroupName; - int clinicID; - String clinicNameArabic; - String clinicNameEnglish; + int? clinicGroupID; + String? clinicGroupName; + int? clinicID; + String? clinicNameArabic; + String? clinicNameEnglish; - Clinic( - {this.clinicGroupID, - this.clinicGroupName, - this.clinicID, - this.clinicNameArabic, - this.clinicNameEnglish}); + Clinic({ + this.clinicGroupID, + this.clinicGroupName, + this.clinicID, + this.clinicNameArabic, + this.clinicNameEnglish, + }); - Clinic.fromJson(Map json) { - clinicGroupID = json['clinicGroupID']; - clinicGroupName = json['clinicGroupName']; - clinicID = json['clinicID']; - clinicNameArabic = json['clinicNameArabic']; - clinicNameEnglish = json['clinicNameEnglish']; + Clinic.fromJson(Map? json) { + if (json != null) { + clinicGroupID = json['clinicGroupID']; + clinicGroupName = json['clinicGroupName']; + clinicID = json['clinicID']; + clinicNameArabic = json['clinicNameArabic']; + clinicNameEnglish = json['clinicNameEnglish']; + } } Map toJson() { - final Map data = new Map(); - data['clinicGroupID'] = this.clinicGroupID; - data['clinicGroupName'] = this.clinicGroupName; - data['clinicID'] = this.clinicID; - data['clinicNameArabic'] = this.clinicNameArabic; - data['clinicNameEnglish'] = this.clinicNameEnglish; + final Map data = {}; + data['clinicGroupID'] = clinicGroupID; + data['clinicGroupName'] = clinicGroupName; + data['clinicID'] = clinicID; + data['clinicNameArabic'] = clinicNameArabic; + data['clinicNameEnglish'] = clinicNameEnglish; return data; } } diff --git a/lib/core/model/admissionRequest/ward-model.dart b/lib/core/model/admissionRequest/ward-model.dart index 98479fca..d8c2711b 100644 --- a/lib/core/model/admissionRequest/ward-model.dart +++ b/lib/core/model/admissionRequest/ward-model.dart @@ -1,8 +1,8 @@ class WardModel { - String description; - String descriptionN; - int floorID; - bool isActive; + String? description; + String? descriptionN; + int? floorID; + bool? isActive; WardModel({this.description, this.descriptionN, this.floorID, this.isActive}); diff --git a/lib/core/model/admisson_orders/admission_orders_model.dart b/lib/core/model/admisson_orders/admission_orders_model.dart index a0891a02..01539342 100644 --- a/lib/core/model/admisson_orders/admission_orders_model.dart +++ b/lib/core/model/admisson_orders/admission_orders_model.dart @@ -1,15 +1,15 @@ class AdmissionOrdersModel { - int procedureID; - String procedureName; - String procedureNameN; - int orderNo; - int doctorID; - int clinicID; - String createdOn; - int createdBy; - String editedOn; - int editedBy; - String createdByName; + int? procedureID; + String? procedureName; + String? procedureNameN; + int? orderNo; + int? doctorID; + int? clinicID; + String? createdOn; + int? createdBy; + String? editedOn; + int? editedBy; + String? createdByName; AdmissionOrdersModel( {this.procedureID, diff --git a/lib/core/model/admisson_orders/admission_orders_request_model.dart b/lib/core/model/admisson_orders/admission_orders_request_model.dart index 897bb8f8..4b6296e5 100644 --- a/lib/core/model/admisson_orders/admission_orders_request_model.dart +++ b/lib/core/model/admisson_orders/admission_orders_request_model.dart @@ -1,20 +1,20 @@ class AdmissionOrdersRequestModel { - bool isDentalAllowedBackend; - double versionID; - int channel; - int languageID; - String iPAdress; - String generalid; - int deviceTypeID; - String tokenID; - int patientID; - int admissionNo; - String sessionID; - int projectID; - String setupID; - bool patientOutSA; - int patientType; - int patientTypeID; + bool? isDentalAllowedBackend; + double? versionID; + int? channel; + int? languageID; + String? iPAdress; + String? generalid; + int? deviceTypeID; + String? tokenID; + int? patientID; + int? admissionNo; + String? sessionID; + int? projectID; + String? setupID; + bool? patientOutSA; + int? patientType; + int? patientTypeID; AdmissionOrdersRequestModel( {this.isDentalAllowedBackend, diff --git a/lib/core/model/auth/activation_Code_req_model.dart b/lib/core/model/auth/activation_Code_req_model.dart index f6094b9d..0603360e 100644 --- a/lib/core/model/auth/activation_Code_req_model.dart +++ b/lib/core/model/auth/activation_Code_req_model.dart @@ -1,12 +1,12 @@ class ActivationCodeModel { - int channel; - int languageID; - int loginDoctorID; - double versionID; - int memberID; - int facilityId; - String generalid; - String otpSendType; + int? channel; + int? languageID; + int? loginDoctorID; + double? versionID; + int? memberID; + int? facilityId; + String? generalid; + String? otpSendType; ActivationCodeModel( {this.channel, diff --git a/lib/core/model/auth/activation_code_for_verification_screen_model.dart b/lib/core/model/auth/activation_code_for_verification_screen_model.dart index 631ac0ca..d0dce8fa 100644 --- a/lib/core/model/auth/activation_code_for_verification_screen_model.dart +++ b/lib/core/model/auth/activation_code_for_verification_screen_model.dart @@ -1,18 +1,18 @@ class ActivationCodeForVerificationScreenModel { - int oTPSendType; - String mobileNumber; - String zipCode; - int channel; - int loginDoctorID; - int languageID; - double versionID; - int memberID; - int facilityId; - String generalid; - int isMobileFingerPrint; - String vidaAuthTokenID; - String vidaRefreshTokenID; - String iMEI; + int? oTPSendType; + String? mobileNumber; + String? zipCode; + int? channel; + int? loginDoctorID; + int? languageID; + double? versionID; + int? memberID; + int? facilityId; + String? generalid; + int? isMobileFingerPrint; + String? vidaAuthTokenID; + String? vidaRefreshTokenID; + String? iMEI; ActivationCodeForVerificationScreenModel( {this.oTPSendType, diff --git a/lib/core/model/auth/check_activation_code_for_doctor_app_response_model.dart b/lib/core/model/auth/check_activation_code_for_doctor_app_response_model.dart index 6fb7eb70..8796fc35 100644 --- a/lib/core/model/auth/check_activation_code_for_doctor_app_response_model.dart +++ b/lib/core/model/auth/check_activation_code_for_doctor_app_response_model.dart @@ -1,59 +1,48 @@ import 'package:doctor_app_flutter/core/model/doctor/doctor_profile_model.dart'; class CheckActivationCodeForDoctorAppResponseModel { - String authenticationTokenID; - List listDoctorsClinic; - List listDoctorProfile; - MemberInformation memberInformation; - String vidaAuthTokenID; - String vidaRefreshTokenID; - - CheckActivationCodeForDoctorAppResponseModel( - {this.authenticationTokenID, - this.listDoctorsClinic, - this.memberInformation, - this.listDoctorProfile, - this.vidaAuthTokenID, - this.vidaRefreshTokenID}); - - CheckActivationCodeForDoctorAppResponseModel.fromJson( - Map json) { + String? authenticationTokenID; + List? listDoctorsClinic; + List? listDoctorProfile; + MemberInformation? memberInformation; + String? vidaAuthTokenID; + String? vidaRefreshTokenID; + + CheckActivationCodeForDoctorAppResponseModel({this.authenticationTokenID, this.listDoctorsClinic, this.memberInformation, this.listDoctorProfile, this.vidaAuthTokenID, this.vidaRefreshTokenID}); + + CheckActivationCodeForDoctorAppResponseModel.fromJson(Map json) { authenticationTokenID = json['AuthenticationTokenID']; if (json['List_DoctorsClinic'] != null) { - listDoctorsClinic = new List(); + listDoctorsClinic = []; json['List_DoctorsClinic'].forEach((v) { - listDoctorsClinic.add(new ListDoctorsClinic.fromJson(v)); + listDoctorsClinic!.add(new ListDoctorsClinic.fromJson(v)); }); } if (json['List_DoctorProfile'] != null) { - listDoctorProfile = new List(); + listDoctorProfile = []; json['List_DoctorProfile'].forEach((v) { - listDoctorProfile.add(new DoctorProfileModel.fromJson(v)); + listDoctorProfile!.add(new DoctorProfileModel.fromJson(v)); }); } vidaAuthTokenID = json['VidaAuthTokenID']; vidaRefreshTokenID = json['VidaRefreshTokenID']; - memberInformation = json['memberInformation'] != null - ? new MemberInformation.fromJson(json['memberInformation']) - : null; + memberInformation = json['memberInformation'] != null ? new MemberInformation.fromJson(json['memberInformation']) : null; } Map toJson() { final Map data = new Map(); data['AuthenticationTokenID'] = this.authenticationTokenID; if (this.listDoctorsClinic != null) { - data['List_DoctorsClinic'] = - this.listDoctorsClinic.map((v) => v.toJson()).toList(); + data['List_DoctorsClinic'] = this.listDoctorsClinic!.map((v) => v.toJson()).toList(); } if (this.listDoctorProfile != null) { - data['List_DoctorProfile'] = - this.listDoctorProfile.map((v) => v.toJson()).toList(); + data['List_DoctorProfile'] = this.listDoctorProfile!.map((v) => v.toJson()).toList(); } if (this.memberInformation != null) { - data['memberInformation'] = this.memberInformation.toJson(); + data['memberInformation'] = this.memberInformation!.toJson(); } return data; } @@ -61,19 +50,13 @@ class CheckActivationCodeForDoctorAppResponseModel { class ListDoctorsClinic { Null setupID; - int projectID; - int doctorID; - int clinicID; - bool isActive; - String clinicName; - - ListDoctorsClinic( - {this.setupID, - this.projectID, - this.doctorID, - this.clinicID, - this.isActive, - this.clinicName}); + int? projectID; + int? doctorID; + int? clinicID; + bool? isActive; + String? clinicName; + + ListDoctorsClinic({this.setupID, this.projectID, this.doctorID, this.clinicID, this.isActive, this.clinicName}); ListDoctorsClinic.fromJson(Map json) { setupID = json['SetupID']; @@ -97,32 +80,23 @@ class ListDoctorsClinic { } class MemberInformation { - List clinics; - int doctorId; - String email; - int employeeId; - int memberId; + List? clinics; + int? doctorId; + String? email; + int? employeeId; + int? memberId; Null memberName; Null memberNameArabic; - String preferredLanguage; - List roles; - - MemberInformation( - {this.clinics, - this.doctorId, - this.email, - this.employeeId, - this.memberId, - this.memberName, - this.memberNameArabic, - this.preferredLanguage, - this.roles}); + String? preferredLanguage; + List? roles; + + MemberInformation({this.clinics, this.doctorId, this.email, this.employeeId, this.memberId, this.memberName, this.memberNameArabic, this.preferredLanguage, this.roles}); MemberInformation.fromJson(Map json) { if (json['clinics'] != null) { - clinics = new List(); + clinics = []; json['clinics'].forEach((v) { - clinics.add(new Clinics.fromJson(v)); + clinics!.add(new Clinics.fromJson(v)); }); } doctorId = json['doctorId']; @@ -133,9 +107,9 @@ class MemberInformation { memberNameArabic = json['memberNameArabic']; preferredLanguage = json['preferredLanguage']; if (json['roles'] != null) { - roles = new List(); + roles = []; json['roles'].forEach((v) { - roles.add(new Roles.fromJson(v)); + roles!.add(new Roles.fromJson(v)); }); } } @@ -143,7 +117,7 @@ class MemberInformation { Map toJson() { final Map data = new Map(); if (this.clinics != null) { - data['clinics'] = this.clinics.map((v) => v.toJson()).toList(); + data['clinics'] = this.clinics!.map((v) => v.toJson()).toList(); } data['doctorId'] = this.doctorId; data['email'] = this.email; @@ -153,16 +127,16 @@ class MemberInformation { data['memberNameArabic'] = this.memberNameArabic; data['preferredLanguage'] = this.preferredLanguage; if (this.roles != null) { - data['roles'] = this.roles.map((v) => v.toJson()).toList(); + data['roles'] = this.roles!.map((v) => v.toJson()).toList(); } return data; } } class Clinics { - bool defaultClinic; - int id; - String name; + bool? defaultClinic; + int? id; + String? name; Clinics({this.defaultClinic, this.id, this.name}); @@ -182,8 +156,8 @@ class Clinics { } class Roles { - String name; - int roleId; + String? name; + int? roleId; Roles({this.name, this.roleId}); diff --git a/lib/core/model/auth/check_activation_code_request_model.dart b/lib/core/model/auth/check_activation_code_request_model.dart index c8040671..2317fb65 100644 --- a/lib/core/model/auth/check_activation_code_request_model.dart +++ b/lib/core/model/auth/check_activation_code_request_model.dart @@ -1,24 +1,24 @@ class CheckActivationCodeRequestModel { - String mobileNumber; - String zipCode; - int doctorID; - int memberID; - int loginDoctorID; - String password; - String facilityId; - String iPAdress; - int channel; - int languageID; - int projectID; - double versionID; - String generalid; - String logInTokenID; - String activationCode; - String vidaAuthTokenID; - String vidaRefreshTokenID; - String iMEI; - bool isForSilentLogin; - int oTPSendType; + String? mobileNumber; + String? zipCode; + int? doctorID; + int? memberID; + int? loginDoctorID; + String? password; + String? facilityId; + String? iPAdress; + int? channel; + int? languageID; + int? projectID; + double? versionID; + String? generalid; + String? logInTokenID; + String? activationCode; + String? vidaAuthTokenID; + String? vidaRefreshTokenID; + String? iMEI; + bool? isForSilentLogin; + int? oTPSendType; CheckActivationCodeRequestModel( {this.mobileNumber, diff --git a/lib/core/model/auth/imei_details.dart b/lib/core/model/auth/imei_details.dart index 21416074..41c5299e 100644 --- a/lib/core/model/auth/imei_details.dart +++ b/lib/core/model/auth/imei_details.dart @@ -1,33 +1,33 @@ class GetIMEIDetailsModel { - int iD; - String iMEI; - int logInTypeID; - bool outSA; - String mobile; - dynamic identificationNo; - int doctorID; - String doctorName; - String doctorNameN; - int clinicID; - String clinicDescription; - dynamic clinicDescriptionN; - int projectID; - String projectName; - String genderDescription; - dynamic genderDescriptionN; - String titleDescription; - dynamic titleDescriptionN; - dynamic zipCode; - String createdOn; - dynamic createdBy; - String editedOn; - dynamic editedBy; - bool biometricEnabled; - dynamic preferredLanguage; - bool isActive; - String vidaAuthTokenID; - String vidaRefreshTokenID; - String password; + int? iD; + String? iMEI; + int? logInTypeID; + bool? outSA; + String? mobile; + dynamic? identificationNo; + int? doctorID; + String? doctorName; + String? doctorNameN; + int? clinicID; + String? clinicDescription; + dynamic? clinicDescriptionN; + int? projectID; + String? projectName; + String? genderDescription; + dynamic? genderDescriptionN; + String? titleDescription; + dynamic? titleDescriptionN; + dynamic? zipCode; + String? createdOn; + dynamic? createdBy; + String? editedOn; + dynamic? editedBy; + bool? biometricEnabled; + dynamic? preferredLanguage; + bool? isActive; + String? vidaAuthTokenID; + String? vidaRefreshTokenID; + String? password; GetIMEIDetailsModel( {this.iD, diff --git a/lib/core/model/auth/insert_imei_model.dart b/lib/core/model/auth/insert_imei_model.dart index dfc15bd9..af8967fc 100644 --- a/lib/core/model/auth/insert_imei_model.dart +++ b/lib/core/model/auth/insert_imei_model.dart @@ -1,39 +1,38 @@ class InsertIMEIDetailsModel { - String iMEI; - int logInTypeID; - dynamic outSA; - String mobile; - dynamic identificationNo; - int doctorID; - String doctorName; - String doctorNameN; - int clinicID; - String clinicDescription; - Null clinicDescriptionN; - String projectName; - String genderDescription; - Null genderDescriptionN; - String titleDescription; - Null titleDescriptionN; - bool bioMetricEnabled; - Null preferredLanguage; - bool isActive; - int editedBy; - int projectID; - String tokenID; - int languageID; - String stamp; - String iPAdress; - double versionID; - int channel; - String sessionID; - bool isLoginForDoctorApp; - int patientOutSA; - String vidaAuthTokenID; - String vidaRefreshTokenID; - dynamic password; - int loginDoctorID; - + String? iMEI; + int? logInTypeID; + dynamic? outSA; + String? mobile; + dynamic? identificationNo; + int? doctorID; + String? doctorName; + String? doctorNameN; + int? clinicID; + String? clinicDescription; + Null? clinicDescriptionN; + String? projectName; + String? genderDescription; + Null? genderDescriptionN; + String? titleDescription; + Null? titleDescriptionN; + bool? bioMetricEnabled; + Null? preferredLanguage; + bool? isActive; + int? editedBy; + int? projectID; + String? tokenID; + int? languageID; + String? stamp; + String? iPAdress; + double? versionID; + int? channel; + String? sessionID; + bool? isLoginForDoctorApp; + int? patientOutSA; + String? vidaAuthTokenID; + String? vidaRefreshTokenID; + dynamic? password; + int? loginDoctorID; InsertIMEIDetailsModel( {this.iMEI, @@ -68,7 +67,8 @@ class InsertIMEIDetailsModel { this.patientOutSA, this.vidaAuthTokenID, this.vidaRefreshTokenID, - this.password, this.loginDoctorID}); + this.password, + this.loginDoctorID}); InsertIMEIDetailsModel.fromJson(Map json) { iMEI = json['IMEI']; @@ -104,7 +104,8 @@ class InsertIMEIDetailsModel { vidaAuthTokenID = json['VidaAuthTokenID']; vidaRefreshTokenID = json['VidaRefreshTokenID']; password = json['Password']; - loginDoctorID = json['LoginDoctorID']; } + loginDoctorID = json['LoginDoctorID']; + } Map toJson() { final Map data = new Map(); diff --git a/lib/core/model/auth/new_login_information_response_model.dart b/lib/core/model/auth/new_login_information_response_model.dart index 36aa33eb..b8609d75 100644 --- a/lib/core/model/auth/new_login_information_response_model.dart +++ b/lib/core/model/auth/new_login_information_response_model.dart @@ -1,31 +1,32 @@ class NewLoginInformationModel { - int doctorID; - List listMemberInformation; - String logInTokenID; - String mobileNumber; - Null sELECTDeviceIMEIbyIMEIList; - int userID; - String zipCode; - bool isActiveCode; - bool isSMSSent; + int? doctorID; + List? listMemberInformation; + String? logInTokenID; + String? mobileNumber; + Null? sELECTDeviceIMEIbyIMEIList; + int? userID; + String? zipCode; + bool? isActiveCode; + bool? isSMSSent; - NewLoginInformationModel( - {this.doctorID, - this.listMemberInformation, - this.logInTokenID, - this.mobileNumber, - this.sELECTDeviceIMEIbyIMEIList, - this.userID, - this.zipCode, - this.isActiveCode, - this.isSMSSent}); + NewLoginInformationModel({ + this.doctorID, + this.listMemberInformation, + this.logInTokenID, + this.mobileNumber, + this.sELECTDeviceIMEIbyIMEIList, + this.userID, + this.zipCode, + this.isActiveCode, + this.isSMSSent, + }); NewLoginInformationModel.fromJson(Map json) { doctorID = json['DoctorID']; if (json['List_MemberInformation'] != null) { - listMemberInformation = new List(); + listMemberInformation = []; json['List_MemberInformation'].forEach((v) { - listMemberInformation.add(new ListMemberInformation.fromJson(v)); + listMemberInformation?.add(ListMemberInformation.fromJson(v)); }); } logInTokenID = json['LogInTokenID']; @@ -38,48 +39,49 @@ class NewLoginInformationModel { } Map toJson() { - final Map data = new Map(); - data['DoctorID'] = this.doctorID; - if (this.listMemberInformation != null) { + final Map data = {}; + data['DoctorID'] = doctorID; + if (listMemberInformation != null) { data['List_MemberInformation'] = - this.listMemberInformation.map((v) => v.toJson()).toList(); + listMemberInformation?.map((v) => v.toJson()).toList(); } - data['LogInTokenID'] = this.logInTokenID; - data['MobileNumber'] = this.mobileNumber; - data['SELECTDeviceIMEIbyIMEI_List'] = this.sELECTDeviceIMEIbyIMEIList; - data['UserID'] = this.userID; - data['ZipCode'] = this.zipCode; - data['isActiveCode'] = this.isActiveCode; - data['isSMSSent'] = this.isSMSSent; + data['LogInTokenID'] = logInTokenID; + data['MobileNumber'] = mobileNumber; + data['SELECTDeviceIMEIbyIMEI_List'] = sELECTDeviceIMEIbyIMEIList; + data['UserID'] = userID; + data['ZipCode'] = zipCode; + data['isActiveCode'] = isActiveCode; + data['isSMSSent'] = isSMSSent; return data; } } class ListMemberInformation { - Null setupID; - int memberID; - String memberName; - Null memberNameN; - String preferredLang; - String pIN; - String saltHash; - int referenceID; - int employeeID; - int roleID; - int projectid; + Null? setupID; + int? memberID; + String? memberName; + Null? memberNameN; + String? preferredLang; + String? pIN; + String? saltHash; + int? referenceID; + int? employeeID; + int? roleID; + int? projectid; - ListMemberInformation( - {this.setupID, - this.memberID, - this.memberName, - this.memberNameN, - this.preferredLang, - this.pIN, - this.saltHash, - this.referenceID, - this.employeeID, - this.roleID, - this.projectid}); + ListMemberInformation({ + this.setupID, + this.memberID, + this.memberName, + this.memberNameN, + this.preferredLang, + this.pIN, + this.saltHash, + this.referenceID, + this.employeeID, + this.roleID, + this.projectid, + }); ListMemberInformation.fromJson(Map json) { setupID = json['SetupID']; @@ -96,18 +98,18 @@ class ListMemberInformation { } Map toJson() { - final Map data = new Map(); - data['SetupID'] = this.setupID; - data['MemberID'] = this.memberID; - data['MemberName'] = this.memberName; - data['MemberNameN'] = this.memberNameN; - data['PreferredLang'] = this.preferredLang; - data['PIN'] = this.pIN; - data['SaltHash'] = this.saltHash; - data['ReferenceID'] = this.referenceID; - data['EmployeeID'] = this.employeeID; - data['RoleID'] = this.roleID; - data['projectid'] = this.projectid; + final Map data = {}; + data['SetupID'] = setupID; + data['MemberID'] = memberID; + data['MemberName'] = memberName; + data['MemberNameN'] = memberNameN; + data['PreferredLang'] = preferredLang; + data['PIN'] = pIN; + data['SaltHash'] = saltHash; + data['ReferenceID'] = referenceID; + data['EmployeeID'] = employeeID; + data['RoleID'] = roleID; + data['projectid'] = projectid; return data; } } diff --git a/lib/core/model/auth/send_activation_code_for_doctor_app_response_model.dart b/lib/core/model/auth/send_activation_code_for_doctor_app_response_model.dart index 099ac738..fa07a395 100644 --- a/lib/core/model/auth/send_activation_code_for_doctor_app_response_model.dart +++ b/lib/core/model/auth/send_activation_code_for_doctor_app_response_model.dart @@ -1,8 +1,8 @@ class SendActivationCodeForDoctorAppResponseModel { - String logInTokenID; - String verificationCode; - String vidaAuthTokenID; - String vidaRefreshTokenID; + String? logInTokenID; + String? verificationCode; + String? vidaAuthTokenID; + String? vidaRefreshTokenID; SendActivationCodeForDoctorAppResponseModel( {this.logInTokenID, diff --git a/lib/core/model/charts/app_time_series_chart.dart b/lib/core/model/charts/app_time_series_chart.dart index 2d77bf88..8db6d611 100644 --- a/lib/core/model/charts/app_time_series_chart.dart +++ b/lib/core/model/charts/app_time_series_chart.dart @@ -1,9 +1,3 @@ -import 'package:charts_flutter/flutter.dart' as charts; -import 'package:charts_flutter/flutter.dart'; -import 'package:doctor_app_flutter/config/size_config.dart'; -import 'package:doctor_app_flutter/widgets/data_display/list/flexible_container.dart'; -import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; -import 'package:flutter/material.dart'; class TimeSeriesSales { final DateTime time; final int sales; diff --git a/lib/core/model/dashboard/dashboard_model.dart b/lib/core/model/dashboard/dashboard_model.dart index 0e03e899..539dbee4 100644 --- a/lib/core/model/dashboard/dashboard_model.dart +++ b/lib/core/model/dashboard/dashboard_model.dart @@ -1,7 +1,7 @@ class DashboardModel { - String kPIName; - int displaySequence; - List summaryoptions; + String? kPIName; + int? displaySequence; + List? summaryoptions; DashboardModel({this.kPIName, this.displaySequence, this.summaryoptions}); @@ -9,9 +9,9 @@ class DashboardModel { kPIName = json['KPIName']; displaySequence = json['displaySequence']; if (json['summaryoptions'] != null) { - summaryoptions = new List(); + summaryoptions = []; json['summaryoptions'].forEach((v) { - summaryoptions.add(new Summaryoptions.fromJson(v)); + summaryoptions!.add(new Summaryoptions.fromJson(v)); }); } } @@ -22,20 +22,20 @@ class DashboardModel { data['displaySequence'] = this.displaySequence; if (this.summaryoptions != null) { data['summaryoptions'] = - this.summaryoptions.map((v) => v.toJson()).toList(); + this.summaryoptions!.map((v) => v.toJson()).toList(); } return data; } } class Summaryoptions { - String kPIParameter; - String captionColor; - bool isCaptionBold; - bool isValueBold; - int order; - int value; - String valueColor; + String? kPIParameter; + String? captionColor; + bool? isCaptionBold; + bool? isValueBold; + int? order; + int? value; + String? valueColor; Summaryoptions( {this.kPIParameter, diff --git a/lib/core/model/dashboard/get_special_clinical_care_List_Respose_Model.dart b/lib/core/model/dashboard/get_special_clinical_care_List_Respose_Model.dart index 4048a402..ff1575b0 100644 --- a/lib/core/model/dashboard/get_special_clinical_care_List_Respose_Model.dart +++ b/lib/core/model/dashboard/get_special_clinical_care_List_Respose_Model.dart @@ -1,9 +1,9 @@ class GetSpecialClinicalCareListResponseModel { - int projectID; - int clinicID; - String clinicDescription; - String clinicDescriptionN; - bool isActive; + int? projectID; + int? clinicID; + String? clinicDescription; + String? clinicDescriptionN; + bool? isActive; GetSpecialClinicalCareListResponseModel( {this.projectID, diff --git a/lib/core/model/dashboard/get_special_clinical_care_mapping_List_Respose_Model.dart b/lib/core/model/dashboard/get_special_clinical_care_mapping_List_Respose_Model.dart index 2a5e3565..cd301bb8 100644 --- a/lib/core/model/dashboard/get_special_clinical_care_mapping_List_Respose_Model.dart +++ b/lib/core/model/dashboard/get_special_clinical_care_mapping_List_Respose_Model.dart @@ -1,10 +1,10 @@ class GetSpecialClinicalCareMappingListResponseModel { - int mappingProjectID; - int clinicID; - int nursingStationID; - bool isActive; - int projectID; - String description; + int? mappingProjectID; + int? clinicID; + int? nursingStationID; + bool? isActive; + int? projectID; + String? description; GetSpecialClinicalCareMappingListResponseModel( {this.mappingProjectID, diff --git a/lib/core/model/diabetic_chart/DiabeticType.dart b/lib/core/model/diabetic_chart/DiabeticType.dart index 26641e61..8a9cfbe1 100644 --- a/lib/core/model/diabetic_chart/DiabeticType.dart +++ b/lib/core/model/diabetic_chart/DiabeticType.dart @@ -1,7 +1,7 @@ class DiabeticType { - int value; - String nameEn; - String nameAr; + int? value; + String? nameEn; + String? nameAr; DiabeticType({this.value, this.nameEn, this.nameAr}); diff --git a/lib/core/model/diabetic_chart/GetDiabeticChartValuesRequestModel.dart b/lib/core/model/diabetic_chart/GetDiabeticChartValuesRequestModel.dart index 7d42014a..34a8e997 100644 --- a/lib/core/model/diabetic_chart/GetDiabeticChartValuesRequestModel.dart +++ b/lib/core/model/diabetic_chart/GetDiabeticChartValuesRequestModel.dart @@ -1,12 +1,12 @@ class GetDiabeticChartValuesRequestModel { - int deviceTypeID; - int patientID; - int resultType; - int admissionNo; - String setupID; - bool patientOutSA; - int patientType; - int patientTypeID; + int? deviceTypeID; + int? patientID; + int? resultType; + int? admissionNo; + String? setupID; + bool? patientOutSA; + int? patientType; + int? patientTypeID; GetDiabeticChartValuesRequestModel( {this.deviceTypeID, diff --git a/lib/core/model/diabetic_chart/GetDiabeticChartValuesResponseModel.dart b/lib/core/model/diabetic_chart/GetDiabeticChartValuesResponseModel.dart index 4696f6be..1e5dd8fd 100644 --- a/lib/core/model/diabetic_chart/GetDiabeticChartValuesResponseModel.dart +++ b/lib/core/model/diabetic_chart/GetDiabeticChartValuesResponseModel.dart @@ -1,10 +1,10 @@ class GetDiabeticChartValuesResponseModel { - String resultType; - int admissionNo; - String dateChart; - int resultValue; - int createdBy; - String createdOn; + String? resultType; + int? admissionNo; + String? dateChart; + int? resultValue; + int? createdBy; + String? createdOn; GetDiabeticChartValuesResponseModel( {this.resultType, diff --git a/lib/core/model/diagnosis/GetDiagnosisForInPatientRequestModel.dart b/lib/core/model/diagnosis/GetDiagnosisForInPatientRequestModel.dart index cb588e1a..bea61fc9 100644 --- a/lib/core/model/diagnosis/GetDiagnosisForInPatientRequestModel.dart +++ b/lib/core/model/diagnosis/GetDiagnosisForInPatientRequestModel.dart @@ -1,9 +1,9 @@ class GetDiagnosisForInPatientRequestModel { - int patientID; - int admissionNo; - String setupID; - int patientType; - int patientTypeID; + int? patientID; + int? admissionNo; + String? setupID; + int? patientType; + int? patientTypeID; GetDiagnosisForInPatientRequestModel( {this.patientID, diff --git a/lib/core/model/diagnosis/GetDiagnosisForInPatientResponseModel.dart b/lib/core/model/diagnosis/GetDiagnosisForInPatientResponseModel.dart index d35d1022..491ac591 100644 --- a/lib/core/model/diagnosis/GetDiagnosisForInPatientResponseModel.dart +++ b/lib/core/model/diagnosis/GetDiagnosisForInPatientResponseModel.dart @@ -1,15 +1,15 @@ class GetDiagnosisForInPatientResponseModel { - String iCDCode10ID; - int diagnosisTypeID; - int conditionID; - bool complexDiagnosis; - String asciiDesc; - int createdBy; - String createdOn; - int editedBy; - String editedOn; - String createdByName; - String editedByName; + String? iCDCode10ID; + int? diagnosisTypeID; + int? conditionID; + bool? complexDiagnosis; + String? asciiDesc; + int? createdBy; + String? createdOn; + int? editedBy; + String? editedOn; + String? createdByName; + String? editedByName; GetDiagnosisForInPatientResponseModel( {this.iCDCode10ID, diff --git a/lib/core/model/discharge_summary/GetDischargeSummaryReqModel.dart b/lib/core/model/discharge_summary/GetDischargeSummaryReqModel.dart index 3bc5f931..cc643e3f 100644 --- a/lib/core/model/discharge_summary/GetDischargeSummaryReqModel.dart +++ b/lib/core/model/discharge_summary/GetDischargeSummaryReqModel.dart @@ -1,8 +1,8 @@ class GetDischargeSummaryReqModel { - int patientID; - int admissionNo; - int patientType; - int patientTypeID; + int? patientID; + int? admissionNo; + int? patientType; + int? patientTypeID; GetDischargeSummaryReqModel( {this.patientID, diff --git a/lib/core/model/discharge_summary/GetDischargeSummaryResModel.dart b/lib/core/model/discharge_summary/GetDischargeSummaryResModel.dart index 10ddab00..f98eb82c 100644 --- a/lib/core/model/discharge_summary/GetDischargeSummaryResModel.dart +++ b/lib/core/model/discharge_summary/GetDischargeSummaryResModel.dart @@ -1,51 +1,51 @@ class GetDischargeSummaryResModel { - String setupID; - int projectID; - int dischargeNo; - String dischargeDate; - int admissionNo; - int assessmentNo; - int patientType; - int patientID; - int clinicID; - int doctorID; - String finalDiagnosis; - String persentation; - String pastHistory; - String planOfCare; - String investigations; - String followupPlan; - String conditionOnDischarge; - String significantFindings; - String planedProcedure; - int daysStayed; - String remarks; - String eRCare; - int status; - bool isActive; - int createdBy; - String createdOn; - int editedBy; - String editedOn; - bool isPatientDied; - dynamic isMedicineApproved; - dynamic isOpenBillDischarge; - dynamic activatedDate; - dynamic activatedBy; - dynamic lAMA; - dynamic patientCodition; - dynamic others; - dynamic reconciliationInstruction; - String dischargeInstructions; - String reason; - dynamic dischargeDisposition; - dynamic hospitalID; - String createdByName; - dynamic createdByNameN; - String editedByName; - dynamic editedByNameN; - String clinicName; - String projectName; + String? setupID; + int? projectID; + int? dischargeNo; + String? dischargeDate; + int? admissionNo; + int? assessmentNo; + int? patientType; + int? patientID; + int? clinicID; + int? doctorID; + String? finalDiagnosis; + String? persentation; + String? pastHistory; + String? planOfCare; + String? investigations; + String? followupPlan; + String? conditionOnDischarge; + String? significantFindings; + String? planedProcedure; + int? daysStayed; + String? remarks; + String? eRCare; + int? status; + bool? isActive; + int? createdBy; + String? createdOn; + int? editedBy; + String? editedOn; + bool? isPatientDied; + dynamic? isMedicineApproved; + dynamic? isOpenBillDischarge; + dynamic? activatedDate; + dynamic? activatedBy; + dynamic? lAMA; + dynamic? patientCodition; + dynamic? others; + dynamic? reconciliationInstruction; + String? dischargeInstructions; + String? reason; + dynamic? dischargeDisposition; + dynamic? hospitalID; + String? createdByName; + dynamic? createdByNameN; + String? editedByName; + dynamic? editedByNameN; + String? clinicName; + String? projectName; GetDischargeSummaryResModel( {this.setupID, diff --git a/lib/core/model/doctor/clinic_model.dart b/lib/core/model/doctor/clinic_model.dart index e5eb8eee..60b58df4 100644 --- a/lib/core/model/doctor/clinic_model.dart +++ b/lib/core/model/doctor/clinic_model.dart @@ -1,17 +1,11 @@ -/* - *@author: Elham Rababah - *@Date:17/5/2020 - *@param: - *@return: - *@desc: Clinic Model - */ + class ClinicModel { Null setupID; - int projectID; - int doctorID; - int clinicID; - bool isActive; - String clinicName; + int? projectID; + int? doctorID; + int? clinicID; + bool? isActive; + String? clinicName; ClinicModel( {this.setupID, diff --git a/lib/core/model/doctor/doctor_profile_model.dart b/lib/core/model/doctor/doctor_profile_model.dart index c2f5b0dd..7638ebbb 100644 --- a/lib/core/model/doctor/doctor_profile_model.dart +++ b/lib/core/model/doctor/doctor_profile_model.dart @@ -1,45 +1,45 @@ class DoctorProfileModel { - int doctorID; - String doctorName; - Null doctorNameN; - int clinicID; - String clinicDescription; - Null clinicDescriptionN; - Null licenseExpiry; - int employmentType; + int? doctorID; + String? doctorName; + dynamic doctorNameN; + int? clinicID; + String? clinicDescription; + dynamic clinicDescriptionN; + dynamic licenseExpiry; + int? employmentType; dynamic setupID; - int projectID; - String projectName; - String nationalityID; - String nationalityName; - Null nationalityNameN; - int gender; - String genderDescription; - Null genderDescriptionN; - Null doctorTitle; - Null projectNameN; - bool isAllowWaitList; - String titleDescription; - Null titleDescriptionN; - Null isRegistered; - Null isDoctorDummy; - bool isActive; - Null isDoctorAppointmentDisplayed; - bool doctorClinicActive; - Null isbookingAllowed; - String doctorCases; - Null doctorPicture; - String doctorProfileInfo; - List specialty; - int actualDoctorRate; - String doctorImageURL; - int doctorRate; - String doctorTitleForProfile; - bool isAppointmentAllowed; - String nationalityFlagURL; - int noOfPatientsRate; - String qR; - int serviceID; + int? projectID; + String? projectName; + String? nationalityID; + String? nationalityName; + dynamic nationalityNameN; + int? gender; + String? genderDescription; + dynamic genderDescriptionN; + dynamic doctorTitle; + dynamic projectNameN; + bool? isAllowWaitList; + String? titleDescription; + dynamic titleDescriptionN; + dynamic isRegistered; + dynamic isDoctorDummy; + bool? isActive; + dynamic isDoctorAppointmentDisplayed; + bool? doctorClinicActive; + dynamic isbookingAllowed; + String? doctorCases; + dynamic doctorPicture; + String? doctorProfileInfo; + List? specialty; + int? actualDoctorRate; + String? doctorImageURL; + int? doctorRate; + String? doctorTitleForProfile; + bool? isAppointmentAllowed; + String? nationalityFlagURL; + int? noOfPatientsRate; + String? qR; + int? serviceID; DoctorProfileModel( {this.doctorID, diff --git a/lib/core/model/doctor/list_doctor_working_hours_table_model.dart b/lib/core/model/doctor/list_doctor_working_hours_table_model.dart index 4ffd6e3b..7bb5faa6 100644 --- a/lib/core/model/doctor/list_doctor_working_hours_table_model.dart +++ b/lib/core/model/doctor/list_doctor_working_hours_table_model.dart @@ -1,11 +1,11 @@ import 'package:doctor_app_flutter/utils/date-utils.dart'; class ListDoctorWorkingHoursTable { - DateTime date; - String dayName; - String workingHours; - String projectName; - String clinicName; + DateTime? date; + String? dayName; + String? workingHours; + String? projectName; + String? clinicName; ListDoctorWorkingHoursTable({ this.date, @@ -34,8 +34,8 @@ class ListDoctorWorkingHoursTable { } class WorkingHours { - String from; - String to; + String? from; + String? to; WorkingHours({this.from, this.to}); } diff --git a/lib/core/model/doctor/list_gt_my_patients_question_model.dart b/lib/core/model/doctor/list_gt_my_patients_question_model.dart index 9b80518d..ad5a461b 100644 --- a/lib/core/model/doctor/list_gt_my_patients_question_model.dart +++ b/lib/core/model/doctor/list_gt_my_patients_question_model.dart @@ -1,37 +1,38 @@ class ListGtMyPatientsQuestions { - Null rowID; - String setupID; - int projectID; - int transactionNo; - int patientType; - int patientID; - int doctorID; - int requestType; - String requestDate; - String requestTime; - String remarks; - int status; - int createdBy; - String createdOn; - int editedBy; - String editedOn; - String patientName; - Null patientNameN; - int gender; - String dateofBirth; - String mobileNumber; - String emailAddress; - int infoStatus; - String infoDesc; - String doctorResponse; + dynamic rowID; + String? setupID; + int? projectID; + int? transactionNo; + int? patientType; + int? patientID; + int? doctorID; + int? requestType; + String? requestDate; + String? requestTime; + String? remarks; + int? status; + int? createdBy; + String? createdOn; + int? editedBy; + String? editedOn; + String? patientName; + dynamic patientNameN; + int? gender; + String? dateofBirth; + String? mobileNumber; + String? emailAddress; + int? infoStatus; + String? infoDesc; + String? doctorResponse; dynamic responseDate; - int memberID; - String memberName; - String memberNameN; - String age; - String genderDescription; - bool isVidaCall; - String requestTypeDescription; + int? memberID; + String? memberName; + String? memberNameN; + String? age; + String? genderDescription; + bool? isVidaCall; + String? requestTypeDescription; + ListGtMyPatientsQuestions( {this.rowID, diff --git a/lib/core/model/doctor/profile_req_Model.dart b/lib/core/model/doctor/profile_req_Model.dart index 115f389d..5e6b8104 100644 --- a/lib/core/model/doctor/profile_req_Model.dart +++ b/lib/core/model/doctor/profile_req_Model.dart @@ -1,24 +1,17 @@ -/* - *@author: Elham Rababah - *@Date:17/5/2020 - *@param: - *@return: - *@desc: ProfileReqModel - */ class ProfileReqModel { - int projectID; - int clinicID; - int doctorID; - bool isRegistered; - bool license; - int languageID; - String stamp; - String iPAdress; - double versionID; - int channel; - String tokenID; - String sessionID; - bool isLoginForDoctorApp; + int? projectID; + int? clinicID; + int? doctorID; + bool? isRegistered; + bool? license; + int? languageID; + String? stamp; + String? iPAdress; + double? versionID; + int? channel; + String? tokenID; + String? sessionID; + bool? isLoginForDoctorApp; ProfileReqModel( {this.projectID, diff --git a/lib/core/model/doctor/replay/request_create_doctor_response.dart b/lib/core/model/doctor/replay/request_create_doctor_response.dart index c169eeec..493dadf7 100644 --- a/lib/core/model/doctor/replay/request_create_doctor_response.dart +++ b/lib/core/model/doctor/replay/request_create_doctor_response.dart @@ -1,24 +1,15 @@ class CreateDoctorResponseModel { - String setupID; - int projectID; - String transactionNo; - int infoEnteredBy; - int infoStatus; - int createdBy; - int editedBy; - String doctorResponse; - int doctorID; + String? setupID; + int? projectID; + String? transactionNo; + int? infoEnteredBy; + int? infoStatus; + int? createdBy; + int? editedBy; + String? doctorResponse; + int? doctorID; - CreateDoctorResponseModel( - {this.setupID, - this.projectID, - this.transactionNo, - this.infoEnteredBy, - this.infoStatus, - this.createdBy, - this.editedBy, - this.doctorResponse, - this.doctorID}); + CreateDoctorResponseModel({this.setupID, this.projectID, this.transactionNo, this.infoEnteredBy, this.infoStatus, this.createdBy, this.editedBy, this.doctorResponse, this.doctorID}); CreateDoctorResponseModel.fromJson(Map json) { setupID = json['SetupID']; diff --git a/lib/core/model/doctor/replay/request_doctor_reply.dart b/lib/core/model/doctor/replay/request_doctor_reply.dart index 15d1f37d..b7aeb1dd 100644 --- a/lib/core/model/doctor/replay/request_doctor_reply.dart +++ b/lib/core/model/doctor/replay/request_doctor_reply.dart @@ -1,21 +1,21 @@ import 'package:doctor_app_flutter/config/config.dart'; class RequestDoctorReply { - int projectID; - int doctorID; - int transactionNo; - int languageID; - String stamp; - String iPAdress; - double versionID; - int channel; - String tokenID; - String sessionID; - bool isLoginForDoctorApp; - bool patientOutSA; - int pageIndex; - int pageSize; - int infoStatus; + int? projectID; + int? doctorID; + int? transactionNo; + int? languageID; + String? stamp; + String? iPAdress; + double? versionID; + int? channel; + String? tokenID; + String? sessionID; + bool? isLoginForDoctorApp; + bool? patientOutSA; + int? pageIndex; + int? pageSize; + int? infoStatus; RequestDoctorReply( {this.projectID, diff --git a/lib/core/model/doctor/request_add_referred_doctor_remarks.dart b/lib/core/model/doctor/request_add_referred_doctor_remarks.dart index f74b3dca..e4d3ecdb 100644 --- a/lib/core/model/doctor/request_add_referred_doctor_remarks.dart +++ b/lib/core/model/doctor/request_add_referred_doctor_remarks.dart @@ -1,22 +1,22 @@ import 'package:doctor_app_flutter/config/config.dart'; class RequestAddReferredDoctorRemarks { - int projectID; - String admissionNo; - int lineItemNo; - String referredDoctorRemarks; - int editedBy; - int patientID; - int referringDoctor; - int languageID; - String stamp; - String iPAdress; - double versionID; - int channel; - String tokenID; - String sessionID; - bool isLoginForDoctorApp; - bool patientOutSA; + int? projectID; + String? admissionNo; + int? lineItemNo; + String? referredDoctorRemarks; + int? editedBy; + int? patientID; + int? referringDoctor; + int? languageID; + String? stamp; + String? iPAdress; + double? versionID; + int? channel; + String? tokenID; + String? sessionID; + bool? isLoginForDoctorApp; + bool? patientOutSA; RequestAddReferredDoctorRemarks( {this.projectID, diff --git a/lib/core/model/doctor/request_schedule.dart b/lib/core/model/doctor/request_schedule.dart index 9c5b0fe9..decd97e6 100644 --- a/lib/core/model/doctor/request_schedule.dart +++ b/lib/core/model/doctor/request_schedule.dart @@ -1,18 +1,18 @@ class RequestSchedule { - int projectID; - int clinicID; - int doctorID; - int doctorWorkingHoursDays; - int languageID; - String stamp; - String iPAdress; - double versionID; - int channel; - String tokenID; - String sessionID; - bool isLoginForDoctorApp; - bool patientOutSA; - int patientTypeID; + int? projectID; + int? clinicID; + int? doctorID; + int? doctorWorkingHoursDays; + int? languageID; + String? stamp; + String? iPAdress; + double? versionID; + int? channel; + String? tokenID; + String? sessionID; + bool? isLoginForDoctorApp; + bool? patientOutSA; + int? patientTypeID; RequestSchedule( {this.projectID, diff --git a/lib/core/model/doctor/statstics_for_certain_doctor_request.dart b/lib/core/model/doctor/statstics_for_certain_doctor_request.dart index 08fa03f3..444df675 100644 --- a/lib/core/model/doctor/statstics_for_certain_doctor_request.dart +++ b/lib/core/model/doctor/statstics_for_certain_doctor_request.dart @@ -1,10 +1,10 @@ class StatsticsForCertainDoctorRequest { - bool outSA; - int doctorID; - String tokenID; - int channel; - int projectID; - String generalid; + bool? outSA; + int? doctorID; + String? tokenID; + int? channel; + int? projectID; + String? generalid; StatsticsForCertainDoctorRequest( {this.outSA, diff --git a/lib/core/model/doctor/user_model.dart b/lib/core/model/doctor/user_model.dart index 95035f8d..66768c8a 100644 --- a/lib/core/model/doctor/user_model.dart +++ b/lib/core/model/doctor/user_model.dart @@ -1,16 +1,16 @@ class UserModel { - String userID; - String password; - int projectID; - int languageID; - String iPAdress; - double versionID; - int channel; - String sessionID; - String tokenID; - String stamp; - bool isLoginForDoctorApp; - int patientOutSA; + String? userID; + String? password; + int? projectID; + int? languageID; + String? iPAdress; + double? versionID; + int? channel; + String? sessionID; + String? tokenID; + String? stamp; + bool? isLoginForDoctorApp; + int? patientOutSA; UserModel( {this.userID, diff --git a/lib/core/model/doctor/verify_referral_doctor_remarks.dart b/lib/core/model/doctor/verify_referral_doctor_remarks.dart index 57cfa743..ef24227d 100644 --- a/lib/core/model/doctor/verify_referral_doctor_remarks.dart +++ b/lib/core/model/doctor/verify_referral_doctor_remarks.dart @@ -1,28 +1,28 @@ import 'package:doctor_app_flutter/config/config.dart'; class VerifyReferralDoctorRemarks { - int projectID; - String admissionNo; - int lineItemNo; - String referredDoctorRemarks; - int editedBy; - int patientID; - int referringDoctor; - int languageID; - String stamp; - String iPAdress; - double versionID; - int channel; - String tokenID; - String sessionID; - bool isLoginForDoctorApp; - bool patientOutSA; - String firstName; + int? projectID; + String? admissionNo; + int? lineItemNo; + String? referredDoctorRemarks; + int? editedBy; + int? patientID; + int? referringDoctor; + int? languageID; + String? stamp; + String? iPAdress; + double? versionID; + int? channel; + String? tokenID; + String? sessionID; + bool? isLoginForDoctorApp; + bool? patientOutSA; + String? firstName; - String middleName; - String lastName; - String patientMobileNumber; - String patientIdentificationID; + String? middleName; + String? lastName; + String? patientMobileNumber; + String? patientIdentificationID; VerifyReferralDoctorRemarks({ this.projectID, diff --git a/lib/core/model/hospitals/get_hospitals_request_model.dart b/lib/core/model/hospitals/get_hospitals_request_model.dart index b858bba4..35925a80 100644 --- a/lib/core/model/hospitals/get_hospitals_request_model.dart +++ b/lib/core/model/hospitals/get_hospitals_request_model.dart @@ -1,24 +1,15 @@ class GetHospitalsRequestModel { - int languageID; - String stamp; - String iPAdress; - double versionID; - int channel; - String tokenID; - String sessionID; - bool isLoginForDoctorApp; - String memberID; + int? languageID; + String? stamp; + String? iPAdress; + double? versionID; + int? channel; + String? tokenID; + String? sessionID; + bool? isLoginForDoctorApp; + String? memberID; - GetHospitalsRequestModel( - {this.languageID, - this.stamp, - this.iPAdress, - this.versionID, - this.channel, - this.tokenID, - this.sessionID, - this.isLoginForDoctorApp, - this.memberID}); + GetHospitalsRequestModel({this.languageID, this.stamp, this.iPAdress, this.versionID, this.channel, this.tokenID, this.sessionID, this.isLoginForDoctorApp, this.memberID}); GetHospitalsRequestModel.fromJson(Map json) { languageID = json['LanguageID']; diff --git a/lib/core/model/hospitals/get_hospitals_response_model.dart b/lib/core/model/hospitals/get_hospitals_response_model.dart index edbc3fe5..9a4262ef 100644 --- a/lib/core/model/hospitals/get_hospitals_response_model.dart +++ b/lib/core/model/hospitals/get_hospitals_response_model.dart @@ -1,7 +1,7 @@ class GetHospitalsResponseModel { - String facilityGroupId; - int facilityId; - String facilityName; + String? facilityGroupId; + int? facilityId; + String? facilityName; GetHospitalsResponseModel( {this.facilityGroupId, this.facilityId, this.facilityName}); diff --git a/lib/core/model/insurance/insurance_approval.dart b/lib/core/model/insurance/insurance_approval.dart index 3320e69b..5f60f4c8 100644 --- a/lib/core/model/insurance/insurance_approval.dart +++ b/lib/core/model/insurance/insurance_approval.dart @@ -1,70 +1,56 @@ class ApporvalDetails { - int approvalNo; + int? approvalNo; + String? procedureName; + String? status; + String? isInvoicedDesc; - String procedureName; - - //String procedureNameN; - String status; - - String isInvoicedDesc; - - ApporvalDetails( - {this.approvalNo, this.procedureName, this.status, this.isInvoicedDesc}); + ApporvalDetails({this.approvalNo, this.procedureName, this.status, this.isInvoicedDesc}); ApporvalDetails.fromJson(Map json) { approvalNo = json['ApprovalNo']; - procedureName = json['ProcedureName']; - status = json['Status']; - isInvoicedDesc = json['IsInvoicedDesc']; } Map toJson() { final Map data = new Map(); - data['ApprovalNo'] = this.approvalNo; - data['ProcedureName'] = this.procedureName; - data['Status'] = this.status; - data['IsInvoicedDesc'] = this.isInvoicedDesc; return data; } } class InsuranceApprovalModel { - List apporvalDetails; - double versionID; - int channel; - int languageID; - String iPAdress; - String generalid; - int patientOutSA; - String sessionID; - bool isDentalAllowedBackend; - int deviceTypeID; - int patientID; - String tokenID; - int patientTypeID; - int patientType; - int eXuldAPPNO; - int projectID; - String doctorName; - String clinicName; - String patientDescription; - int approvalNo; - String approvalStatusDescption; - int unUsedCount; - String doctorImage; - String projectName; - - //String companyName; - String expiryDate; - String rceiptOn; - int appointmentNo; + List? apporvalDetails; + double? versionID; + int? channel; + int? languageID; + String? iPAdress; + String? generalid; + int? patientOutSA; + String? sessionID; + bool? isDentalAllowedBackend; + int? deviceTypeID; + int? patientID; + String? tokenID; + int? patientTypeID; + int? patientType; + int? eXuldAPPNO; + int? projectID; + String? doctorName; + String? clinicName; + String? patientDescription; + int? approvalNo; + String? approvalStatusDescption; + int? unUsedCount; + String? doctorImage; + String? projectName; + String? expiryDate; + String? rceiptOn; + int? appointmentNo; InsuranceApprovalModel( {this.versionID, @@ -127,9 +113,9 @@ class InsuranceApprovalModel { doctorImage = json['DoctorImageURL']; clinicName = json['ClinicName']; if (json['ApporvalDetails'] != null) { - apporvalDetails = new List(); + apporvalDetails = []; json['ApporvalDetails'].forEach((v) { - apporvalDetails.add(new ApporvalDetails.fromJson(v)); + apporvalDetails!.add(new ApporvalDetails.fromJson(v)); }); } appointmentNo = json['AppointmentNo']; diff --git a/lib/core/model/insurance/insurance_approval_in_patient_model.dart b/lib/core/model/insurance/insurance_approval_in_patient_model.dart index f185a8bf..583d1e81 100644 --- a/lib/core/model/insurance/insurance_approval_in_patient_model.dart +++ b/lib/core/model/insurance/insurance_approval_in_patient_model.dart @@ -1,36 +1,36 @@ class InsuranceApprovalInPatientModel { - String setupID; - int projectID; - int approvalNo; - int status; - String approvalDate; - int patientType; - int patientID; - int companyID; - bool subCategoryID; - int doctorID; - int clinicID; - int approvalType; - int inpatientApprovalSubType; + String? setupID; + int? projectID; + int? approvalNo; + int? status; + String? approvalDate; + int? patientType; + int? patientID; + int? companyID; + bool? subCategoryID; + int? doctorID; + int? clinicID; + int? approvalType; + int? inpatientApprovalSubType; dynamic isApprovalOnGross; - String companyApprovalNo; + String? companyApprovalNo; dynamic progNoteOrderNo; - String submitOn; - String receiptOn; - String expiryDate; - int admissionNo; - int admissionRequestNo; - String approvalStatusDescption; + String? submitOn; + String? receiptOn; + String? expiryDate; + int? admissionNo; + int? admissionRequestNo; + String? approvalStatusDescption; dynamic approvalStatusDescptionN; dynamic remarks; - List apporvalDetails; - String clinicName; + List? apporvalDetails; + String? clinicName; dynamic companyName; - String doctorName; - String projectName; - int totaUnUsedCount; - int unUsedCount; - String doctorImage; + String? doctorName; + String? projectName; + int? totaUnUsedCount; + int? unUsedCount; + String? doctorImage; InsuranceApprovalInPatientModel( {this.setupID, @@ -93,9 +93,9 @@ class InsuranceApprovalInPatientModel { approvalStatusDescptionN = json['ApprovalStatusDescptionN']; remarks = json['Remarks']; if (json['ApporvalDetails'] != null) { - apporvalDetails = new List(); + apporvalDetails = []; json['ApporvalDetails'].forEach((v) { - apporvalDetails.add(new ApporvalDetails.fromJson(v)); + apporvalDetails!.add(new ApporvalDetails.fromJson(v)); }); } clinicName = json['ClinicName']; @@ -134,8 +134,7 @@ class InsuranceApprovalInPatientModel { data['ApprovalStatusDescptionN'] = this.approvalStatusDescptionN; data['Remarks'] = this.remarks; if (this.apporvalDetails != null) { - data['ApporvalDetails'] = - this.apporvalDetails.map((v) => v.toJson()).toList(); + data['ApporvalDetails'] = this.apporvalDetails!.map((v) => v.toJson()).toList(); } data['ClinicName'] = this.clinicName; data['CompanyName'] = this.companyName; @@ -148,35 +147,35 @@ class InsuranceApprovalInPatientModel { } class ApporvalDetails { - Null setupID; - Null projectID; - int approvalNo; - Null lineItemNo; - Null orderType; - Null procedureID; - Null toothNo; - Null price; - Null approvedAmount; - Null unapprovedPatientShare; - Null waivedAmount; - Null discountType; - Null discountValue; - Null shareType; - Null patientShareTypeValue; - Null companyShareTypeValue; - Null patientShare; - Null companyShare; - Null deductableAmount; - String disapprovedRemarks; - Null progNoteOrderNo; - Null progNoteLineItemNo; - Null invoiceTransactionType; - Null invoiceNo; - String procedureName; - String procedureNameN; - String status; - Null isInvoiced; - String isInvoicedDesc; + dynamic setupID; + dynamic projectID; + int? approvalNo; + dynamic lineItemNo; + dynamic orderType; + dynamic procedureID; + dynamic toothNo; + dynamic price; + dynamic approvedAmount; + dynamic unapprovedPatientShare; + dynamic waivedAmount; + dynamic discountType; + dynamic discountValue; + dynamic shareType; + dynamic patientShareTypeValue; + dynamic companyShareTypeValue; + dynamic patientShare; + dynamic companyShare; + dynamic deductableAmount; + String? disapprovedRemarks; + dynamic progNoteOrderNo; + dynamic progNoteLineItemNo; + dynamic invoiceTransactionType; + dynamic invoiceNo; + String? procedureName; + String? procedureNameN; + String? status; + dynamic isInvoiced; + String? isInvoicedDesc; ApporvalDetails( {this.setupID, diff --git a/lib/core/model/labs/all_special_lab_result_model.dart b/lib/core/model/labs/all_special_lab_result_model.dart index b1a9cd4b..70b4d2cf 100644 --- a/lib/core/model/labs/all_special_lab_result_model.dart +++ b/lib/core/model/labs/all_special_lab_result_model.dart @@ -5,52 +5,52 @@ class AllSpecialLabResultModel { dynamic appointmentDate; dynamic appointmentNo; dynamic appointmentTime; - String clinicDescription; - String clinicDescriptionEnglish; + String? clinicDescription; + String? clinicDescriptionEnglish; dynamic clinicDescriptionN; dynamic clinicID; dynamic createdOn; - double decimalDoctorRate; + double? decimalDoctorRate; dynamic doctorID; - String doctorImageURL; - String doctorName; - String doctorNameEnglish; + String? doctorImageURL; + String? doctorName; + String? doctorNameEnglish; dynamic doctorNameN; dynamic doctorRate; dynamic doctorStarsRate; - String doctorTitle; + String? doctorTitle; dynamic gender; - String genderDescription; - bool inOutPatient; - String invoiceNo; - bool isActiveDoctorProfile; - bool isDoctorAllowVedioCall; - bool isExecludeDoctor; - bool isInOutPatient; + String? genderDescription; + bool? inOutPatient; + String? invoiceNo; + bool? isActiveDoctorProfile; + bool? isDoctorAllowVedioCall; + bool? isExecludeDoctor; + bool? isInOutPatient; dynamic isInOutPatientDescription; dynamic isInOutPatientDescriptionN; - bool isLiveCareAppointment; - bool isRead; - bool isSendEmail; - String moduleID; - String nationalityFlagURL; + bool? isLiveCareAppointment; + bool? isRead; + bool? isSendEmail; + String? moduleID; + String? nationalityFlagURL; dynamic noOfPatientsRate; dynamic orderDate; - String orderNo; + String? orderNo; dynamic patientID; - String projectID; - String projectName; + String? projectID; + String? projectName; dynamic projectNameN; - String qR; - String resultData; - String resultDataHTML; + String? qR; + String? resultData; + String? resultDataHTML; dynamic resultDataTxt; - String setupID; + String? setupID; //List speciality; dynamic status; dynamic statusDesc; - String strOrderDate; + String? strOrderDate; AllSpecialLabResultModel( {this.actualDoctorRate, diff --git a/lib/core/model/labs/all_special_lab_result_request.dart b/lib/core/model/labs/all_special_lab_result_request.dart index d5df1405..950f0e96 100644 --- a/lib/core/model/labs/all_special_lab_result_request.dart +++ b/lib/core/model/labs/all_special_lab_result_request.dart @@ -1,18 +1,18 @@ class AllSpecialLabResultRequestModel { - double versionID; - int channel; - int languageID; - String iPAdress; - String generalid; - int patientOutSA; - String sessionID; - bool isDentalAllowedBackend; - int deviceTypeID; - String tokenID; - int patientTypeID; - int patientType; - int patientID; - int projectID; + double? versionID; + int? channel; + int? languageID; + String? iPAdress; + String? generalid; + int? patientOutSA; + String? sessionID; + bool? isDentalAllowedBackend; + int? deviceTypeID; + String? tokenID; + int? patientTypeID; + int? patientType; + int? patientID; + int? projectID; AllSpecialLabResultRequestModel( {this.versionID, diff --git a/lib/core/model/labs/lab_order_result.dart b/lib/core/model/labs/lab_order_result.dart index 22bcb801..e3ebac29 100644 --- a/lib/core/model/labs/lab_order_result.dart +++ b/lib/core/model/labs/lab_order_result.dart @@ -1,23 +1,23 @@ class LabOrderResult { - String description; + String? description; dynamic femaleInterpretativeData; - int gender; - int lineItemNo; + int? gender; + int? lineItemNo; dynamic maleInterpretativeData; dynamic notes; - String packageID; - int patientID; - String projectID; - String referanceRange; - String resultValue; - String sampleCollectedOn; - String sampleReceivedOn; - String setupID; + String? packageID; + int? patientID; + String? projectID; + String? referanceRange; + String? resultValue; + String? sampleCollectedOn; + String? sampleReceivedOn; + String? setupID; dynamic superVerifiedOn; - String testCode; - String uOM; - String verifiedOn; - String verifiedOnDateTime; + String? testCode; + String? uOM; + String? verifiedOn; + String? verifiedOnDateTime; LabOrderResult( {this.description, diff --git a/lib/core/model/labs/lab_result.dart b/lib/core/model/labs/lab_result.dart index 046ab169..586f3079 100644 --- a/lib/core/model/labs/lab_result.dart +++ b/lib/core/model/labs/lab_result.dart @@ -1,24 +1,24 @@ class LabResult { - String description; + String? description; dynamic femaleInterpretativeData; - int gender; - int lineItemNo; + int? gender; + int? lineItemNo; dynamic maleInterpretativeData; - String notes; - String packageID; - int patientID; - String projectID; - String referanceRange; - String resultValue; - String maxValue; - String minValue; - String sampleCollectedOn; - String sampleReceivedOn; - String setupID; + String? notes; + String? packageID; + int? patientID; + String? projectID; + String? referanceRange; + String? resultValue; + String? maxValue; + String? minValue; + String? sampleCollectedOn; + String? sampleReceivedOn; + String? setupID; dynamic superVerifiedOn; - String testCode; - String uOM; - String verifiedOn; + String? testCode; + String? uOM; + String? verifiedOn; dynamic verifiedOnDateTime; LabResult( @@ -96,9 +96,9 @@ class LabResult { int checkResultStatus() { try { - var max = double.tryParse(maxValue) ?? null; - var min = double.tryParse(minValue) ?? null; - var result = double.tryParse(resultValue) ?? null; + var max = double.tryParse(maxValue!) ?? null; + var min = double.tryParse(minValue!) ?? null; + var result = double.tryParse(resultValue!) ?? null; if (max != null && min != null && result != null) { if (result > max) { return 1; @@ -118,9 +118,9 @@ class LabResult { class LabResultList { String filterName = ""; - List patientLabResultList = List(); + List patientLabResultList = []; - LabResultList({this.filterName, LabResult lab}) { - patientLabResultList.add(lab); + LabResultList({required this.filterName, LabResult? lab}) { + patientLabResultList.add(lab!); } } diff --git a/lib/core/model/labs/lab_result_history.dart b/lib/core/model/labs/lab_result_history.dart index fed140f8..79211594 100644 --- a/lib/core/model/labs/lab_result_history.dart +++ b/lib/core/model/labs/lab_result_history.dart @@ -1,28 +1,29 @@ class LabResultHistory { - String description; - String femaleInterpretativeData; - int gender; - bool isCertificateAllowed; - int lineItemNo; - String maleInterpretativeData; - String notes; - int orderLineItemNo; - int orderNo; - String packageID; - int patientID; - String projectID; - String referanceRange; - String resultValue; - int resultValueBasedLineItemNo; - String resultValueFlag; - String sampleCollectedOn; - String sampleReceivedOn; - String setupID; - String superVerifiedOn; - String testCode; - String uOM; - String verifiedOn; - String verifiedOnDateTime; + String? description; + String? femaleInterpretativeData; + int? gender; + bool? isCertificateAllowed; + int? lineItemNo; + String? maleInterpretativeData; + String? notes; + int? orderLineItemNo; + int? orderNo; + String? packageID; + int? patientID; + String? projectID; + String? referanceRange; + String? resultValue; + int? resultValueBasedLineItemNo; + String? resultValueFlag; + String? sampleCollectedOn; + String? sampleReceivedOn; + String? setupID; + String? superVerifiedOn; + String? testCode; + String? uOM; + String? verifiedOn; + String? verifiedOnDateTime; + LabResultHistory( {this.description, diff --git a/lib/core/model/labs/patient_lab_orders.dart b/lib/core/model/labs/patient_lab_orders.dart index b481df54..fa58d491 100644 --- a/lib/core/model/labs/patient_lab_orders.dart +++ b/lib/core/model/labs/patient_lab_orders.dart @@ -1,41 +1,42 @@ import 'package:doctor_app_flutter/utils/date-utils.dart'; class PatientLabOrders { - int actualDoctorRate; - String clinicDescription; - String clinicDescriptionEnglish; - Null clinicDescriptionN; - int clinicID; - int doctorID; - String doctorImageURL; - String doctorName; - String doctorNameEnglish; - Null doctorNameN; - int doctorRate; - String doctorTitle; - int gender; - String genderDescription; - String invoiceNo; - bool isActiveDoctorProfile; - bool isDoctorAllowVedioCall; - bool isExecludeDoctor; - bool isInOutPatient; - String isInOutPatientDescription; - String isInOutPatientDescriptionN; - bool isRead; - String nationalityFlagURL; - int noOfPatientsRate; - DateTime orderDate; - DateTime createdOn; - String orderNo; - String patientID; - String projectID; - String projectName; - Null projectNameN; - String qR; - String setupID; - List speciality; - bool isLiveCareAppointment; + int? actualDoctorRate; + String? clinicDescription; + String? clinicDescriptionEnglish; + dynamic clinicDescriptionN; + int? clinicID; + int? doctorID; + String? doctorImageURL; + String? doctorName; + String? doctorNameEnglish; + dynamic doctorNameN; + int? doctorRate; + String? doctorTitle; + int? gender; + String? genderDescription; + String? invoiceNo; + bool? isActiveDoctorProfile; + bool? isDoctorAllowVedioCall; + bool? isExecludeDoctor; + bool? isInOutPatient; + String? isInOutPatientDescription; + String? isInOutPatientDescriptionN; + bool? isRead; + String? nationalityFlagURL; + int? noOfPatientsRate; + DateTime? orderDate; + DateTime? createdOn; + String? orderNo; + String? patientID; + String? projectID; + String? projectName; + dynamic projectNameN; + String? qR; + String? setupID; + List? speciality; + bool? isLiveCareAppointment; + PatientLabOrders( {this.actualDoctorRate, @@ -153,10 +154,10 @@ class PatientLabOrders { class PatientLabOrdersList { String filterName = ""; - List patientLabOrdersList = List(); + List patientLabOrdersList = []; PatientLabOrdersList( - {this.filterName, PatientLabOrders patientDoctorAppointment}) { - patientLabOrdersList.add(patientDoctorAppointment); + {required this.filterName, PatientLabOrders? patientDoctorAppointment}) { + patientLabOrdersList.add(patientDoctorAppointment!); } } diff --git a/lib/core/model/labs/patient_lab_special_result.dart b/lib/core/model/labs/patient_lab_special_result.dart index dc53010b..1d224c05 100644 --- a/lib/core/model/labs/patient_lab_special_result.dart +++ b/lib/core/model/labs/patient_lab_special_result.dart @@ -1,9 +1,9 @@ class PatientLabSpecialResult { - String invoiceNo; - String moduleID; - String resultData; - String resultDataHTML; - Null resultDataTxt; + String? invoiceNo; + String? moduleID; + String? resultData; + String? resultDataHTML; + dynamic resultDataTxt; PatientLabSpecialResult( {this.invoiceNo, diff --git a/lib/core/model/labs/request_patient_lab_special_result.dart b/lib/core/model/labs/request_patient_lab_special_result.dart index 1a149bcd..bac33689 100644 --- a/lib/core/model/labs/request_patient_lab_special_result.dart +++ b/lib/core/model/labs/request_patient_lab_special_result.dart @@ -1,22 +1,23 @@ class RequestPatientLabSpecialResult { - String invoiceNo; - String orderNo; - String setupID; - String projectID; - int clinicID; - double versionID; - int channel; - int languageID; - String iPAdress; - String generalid; - int patientOutSA; - String sessionID; - bool isDentalAllowedBackend; - int deviceTypeID; - int patientID; - String tokenID; - int patientTypeID; - int patientType; + String? invoiceNo; + String? orderNo; + String? setupID; + String? projectID; + int? clinicID; + double? versionID; + int? channel; + int? languageID; + String? iPAdress; + String? generalid; + int? patientOutSA; + String? sessionID; + bool? isDentalAllowedBackend; + int? deviceTypeID; + int? patientID; + String? tokenID; + int? patientTypeID; + int? patientType; + RequestPatientLabSpecialResult( {this.invoiceNo, diff --git a/lib/core/model/labs/request_send_lab_report_email.dart b/lib/core/model/labs/request_send_lab_report_email.dart index dd8769bb..d4ac0286 100644 --- a/lib/core/model/labs/request_send_lab_report_email.dart +++ b/lib/core/model/labs/request_send_lab_report_email.dart @@ -1,29 +1,30 @@ class RequestSendLabReportEmail { - double versionID; - int channel; - int languageID; - String iPAdress; - String generalid; - int patientOutSA; - String sessionID; - bool isDentalAllowedBackend; - int deviceTypeID; - int patientID; - String tokenID; - int patientTypeID; - int patientType; - String to; - String dateofBirth; - String patientIditificationNum; - String patientMobileNumber; - String patientName; - String setupID; - String projectName; - String clinicName; - String doctorName; - String projectID; - String invoiceNo; - String orderDate; + double? versionID; + int? channel; + int? languageID; + String? iPAdress; + String? generalid; + int? patientOutSA; + String? sessionID; + bool? isDentalAllowedBackend; + int? deviceTypeID; + int? patientID; + String? tokenID; + int? patientTypeID; + int? patientType; + String? to; + String? dateofBirth; + String? patientIditificationNum; + String? patientMobileNumber; + String? patientName; + String? setupID; + String? projectName; + String? clinicName; + String? doctorName; + String? projectID; + String? invoiceNo; + String? orderDate; + RequestSendLabReportEmail( {this.versionID, diff --git a/lib/core/model/live_care/AlternativeServicesList.dart b/lib/core/model/live_care/AlternativeServicesList.dart index fc511da3..eb5c69a8 100644 --- a/lib/core/model/live_care/AlternativeServicesList.dart +++ b/lib/core/model/live_care/AlternativeServicesList.dart @@ -1,9 +1,9 @@ import 'package:flutter/material.dart'; class AlternativeService { - int serviceID; - String serviceName; - bool isSelected; + int? serviceID; + String? serviceName; + bool? isSelected; AlternativeService( {this.serviceID, this.serviceName, this.isSelected = false}); @@ -23,7 +23,7 @@ class AlternativeService { } class AlternativeServicesList with ChangeNotifier { - List _alternativeServicesList; + List _alternativeServicesList = []; getServicesList() { return _alternativeServicesList; diff --git a/lib/core/model/live_care/PendingPatientERForDoctorAppRequestModel.dart b/lib/core/model/live_care/PendingPatientERForDoctorAppRequestModel.dart index dc1f25b3..407e266f 100644 --- a/lib/core/model/live_care/PendingPatientERForDoctorAppRequestModel.dart +++ b/lib/core/model/live_care/PendingPatientERForDoctorAppRequestModel.dart @@ -1,7 +1,7 @@ class PendingPatientERForDoctorAppRequestModel { - bool outSA; - int doctorID; - String sErServiceID; + bool? outSA; + int? doctorID; + String? sErServiceID; PendingPatientERForDoctorAppRequestModel( {this.outSA, this.doctorID, this.sErServiceID}); diff --git a/lib/core/model/live_care/add_patient_to_doctor_list_request_model.dart b/lib/core/model/live_care/add_patient_to_doctor_list_request_model.dart index 809af1b4..f96016d7 100644 --- a/lib/core/model/live_care/add_patient_to_doctor_list_request_model.dart +++ b/lib/core/model/live_care/add_patient_to_doctor_list_request_model.dart @@ -1,9 +1,9 @@ class AddPatientToDoctorListRequestModel { - int vCID; - String tokenID; - String generalid; - int doctorId; - bool isOutKsa; + int? vCID; + String? tokenID; + String? generalid; + int? doctorId; + bool? isOutKsa; AddPatientToDoctorListRequestModel( {this.vCID, this.tokenID, this.generalid, this.doctorId, this.isOutKsa}); diff --git a/lib/core/model/live_care/live_care_login_reguest_model.dart b/lib/core/model/live_care/live_care_login_reguest_model.dart index b1218420..a4b9a92c 100644 --- a/lib/core/model/live_care/live_care_login_reguest_model.dart +++ b/lib/core/model/live_care/live_care_login_reguest_model.dart @@ -1,9 +1,9 @@ class LiveCareUserLoginRequestModel { - String tokenID; - String generalid; - int doctorId; - int isOutKsa; - int isLogin; + String? tokenID; + String? generalid; + int? doctorId; + int? isOutKsa; + int? isLogin; LiveCareUserLoginRequestModel( {this.tokenID, diff --git a/lib/core/model/livecare/end_call_req.dart b/lib/core/model/livecare/end_call_req.dart index 7a1ae8eb..533bc02b 100644 --- a/lib/core/model/livecare/end_call_req.dart +++ b/lib/core/model/livecare/end_call_req.dart @@ -1,9 +1,9 @@ class EndCallReq { - int vCID; - String tokenID; - String generalid; - int doctorId; - bool isDestroy; + int? vCID; + String? tokenID; + String? generalid; + int? doctorId; + bool? isDestroy; EndCallReq( {this.vCID, this.tokenID, this.generalid, this.doctorId, this.isDestroy}); diff --git a/lib/core/model/livecare/get_panding_req_list.dart b/lib/core/model/livecare/get_panding_req_list.dart index 719b9134..521e9a5f 100644 --- a/lib/core/model/livecare/get_panding_req_list.dart +++ b/lib/core/model/livecare/get_panding_req_list.dart @@ -1,9 +1,9 @@ class LiveCarePendingListRequest { - PatientData patientData; - int doctorID; - String sErServiceID; - int projectID; - int sourceID; + PatientData? patientData; + int? doctorID; + String? sErServiceID; + int? projectID; + int? sourceID; LiveCarePendingListRequest( {this.patientData, @@ -23,7 +23,7 @@ class LiveCarePendingListRequest { Map toJson() { final Map data = new Map(); - data['PatientData'] = this.patientData.toJson(); + data['PatientData'] = this.patientData!.toJson(); data['DoctorID'] = this.doctorID; data['SErServiceID'] = this.sErServiceID; data['ProjectID'] = this.projectID; @@ -33,7 +33,7 @@ class LiveCarePendingListRequest { } class PatientData { - bool isOutKSA; + bool? isOutKSA; PatientData({this.isOutKSA}); diff --git a/lib/core/model/livecare/get_pending_res_list.dart b/lib/core/model/livecare/get_pending_res_list.dart index b45c53b9..1faeadfb 100644 --- a/lib/core/model/livecare/get_pending_res_list.dart +++ b/lib/core/model/livecare/get_pending_res_list.dart @@ -1,43 +1,43 @@ class LiveCarePendingListResponse { dynamic acceptedBy; dynamic acceptedOn; - int age; + int? age; dynamic appointmentNo; - String arrivalTime; - String arrivalTimeD; - int callStatus; - String clientRequestID; - String clinicName; + String? arrivalTime; + String? arrivalTimeD; + int? callStatus; + String? clientRequestID; + String? clinicName; dynamic consoltationEnd; dynamic consultationNotes; dynamic createdOn; - String dateOfBirth; - String deviceToken; - String deviceType; + String? dateOfBirth; + String? deviceToken; + String? deviceType; dynamic doctorName; - String editOn; - String gender; - bool isFollowUP; + String? editOn; + String? gender; + bool? isFollowUP; dynamic isFromVida; - int isLoginB; - bool isOutKSA; - int isRejected; - String language; - double latitude; - double longitude; - String mobileNumber; + int? isLoginB; + bool? isOutKSA; + int? isRejected; + String? language; + double? latitude; + double? longitude; + String? mobileNumber; dynamic openSession; dynamic openTokenID; - String patientID; - String patientName; - int patientStatus; - String preferredLanguage; - int projectID; - double scoring; - int serviceID; + String? patientID; + String? patientName; + int? patientStatus; + String? preferredLanguage; + int? projectID; + double? scoring; + int? serviceID; dynamic tokenID; - int vCID; - String voipToken; + int? vCID; + String? voipToken; LiveCarePendingListResponse( {this.acceptedBy, diff --git a/lib/core/model/livecare/session_status_model.dart b/lib/core/model/livecare/session_status_model.dart index 29f925d7..18d5ae6b 100644 --- a/lib/core/model/livecare/session_status_model.dart +++ b/lib/core/model/livecare/session_status_model.dart @@ -1,14 +1,10 @@ class SessionStatusModel { - bool isAuthenticated; - int messageStatus; - String result; - int sessionStatus; + bool? isAuthenticated; + int? messageStatus; + String? result; + int? sessionStatus; - SessionStatusModel( - {this.isAuthenticated, - this.messageStatus, - this.result, - this.sessionStatus}); + SessionStatusModel({this.isAuthenticated, this.messageStatus, this.result, this.sessionStatus}); SessionStatusModel.fromJson(Map json) { isAuthenticated = json['IsAuthenticated']; diff --git a/lib/core/model/livecare/start_call_req.dart b/lib/core/model/livecare/start_call_req.dart index c298298d..12bba14f 100644 --- a/lib/core/model/livecare/start_call_req.dart +++ b/lib/core/model/livecare/start_call_req.dart @@ -1,15 +1,15 @@ class StartCallReq { - String clincName; - int clinicId; - String docSpec; - String docotrName; - int doctorId; - String generalid; - bool isOutKsa; - bool isrecall; - String projectName; - String tokenID; - int vCID; + String? clincName; + int? clinicId; + String? docSpec; + String? docotrName; + int? doctorId; + String? generalid; + bool? isOutKsa; + bool? isrecall; + String? projectName; + String? tokenID; + int? vCID; StartCallReq( {this.clincName, diff --git a/lib/core/model/livecare/start_call_res.dart b/lib/core/model/livecare/start_call_res.dart index 36127da9..c4b0d224 100644 --- a/lib/core/model/livecare/start_call_res.dart +++ b/lib/core/model/livecare/start_call_res.dart @@ -1,11 +1,11 @@ class StartCallRes { - String result; - String openSessionID; - String openTokenID; - bool isAuthenticated; - int messageStatus; - String appointmentNo; - bool isRecording; + String? result; + String? openSessionID; + String? openTokenID; + bool? isAuthenticated; + int? messageStatus; + String? appointmentNo; + bool? isRecording; StartCallRes({ this.result, diff --git a/lib/core/model/livecare/transfer_to_admin.dart b/lib/core/model/livecare/transfer_to_admin.dart index 841f5e7d..040ff39a 100644 --- a/lib/core/model/livecare/transfer_to_admin.dart +++ b/lib/core/model/livecare/transfer_to_admin.dart @@ -1,10 +1,10 @@ class TransferToAdminReq { - int vCID; - String tokenID; - String generalid; - int doctorId; - bool isOutKsa; - String notes; + int? vCID; + String? tokenID; + String? generalid; + int? doctorId; + bool? isOutKsa; + String? notes; TransferToAdminReq( {this.vCID, diff --git a/lib/core/model/medical_report/medical_file_model.dart b/lib/core/model/medical_report/medical_file_model.dart index deebb2af..c903a16c 100644 --- a/lib/core/model/medical_report/medical_file_model.dart +++ b/lib/core/model/medical_report/medical_file_model.dart @@ -1,14 +1,14 @@ class MedicalFileModel { - List entityList; + List? entityList; dynamic statusMessage; MedicalFileModel({this.entityList, this.statusMessage}); MedicalFileModel.fromJson(Map json) { if (json['entityList'] != null) { - entityList = new List(); + entityList = []; json['entityList'].forEach((v) { - entityList.add(new EntityList.fromJson(v)); + entityList!.add(new EntityList.fromJson(v)); }); } statusMessage = json['statusMessage']; @@ -17,7 +17,7 @@ class MedicalFileModel { Map toJson() { final Map data = new Map(); if (this.entityList != null) { - data['entityList'] = this.entityList.map((v) => v.toJson()).toList(); + data['entityList'] = this.entityList!.map((v) => v.toJson()).toList(); } data['statusMessage'] = this.statusMessage; return data; @@ -25,15 +25,15 @@ class MedicalFileModel { } class EntityList { - List timelines; + List? timelines; EntityList({this.timelines}); EntityList.fromJson(Map json) { if (json['Timelines'] != null) { - timelines = new List(); + timelines = []; json['Timelines'].forEach((v) { - timelines.add(new Timelines.fromJson(v)); + timelines!.add(new Timelines.fromJson(v)); }); } } @@ -41,25 +41,25 @@ class EntityList { Map toJson() { final Map data = new Map(); if (this.timelines != null) { - data['Timelines'] = this.timelines.map((v) => v.toJson()).toList(); + data['Timelines'] = this.timelines!.map((v) => v.toJson()).toList(); } return data; } } class Timelines { - int clinicId; - String clinicName; - String date; - int doctorId; - String doctorImage; - String doctorName; - int encounterNumber; - String encounterType; - int projectID; - String projectName; - String setupID; - List timeLineEvents; + int? clinicId; + String? clinicName; + String? date; + int? doctorId; + String? doctorImage; + String? doctorName; + int? encounterNumber; + String? encounterType; + int? projectID; + String? projectName; + String? setupID; + List? timeLineEvents; Timelines( {this.clinicId, @@ -88,9 +88,9 @@ class Timelines { projectName = json['ProjectName']; setupID = json['SetupID']; if (json['TimeLineEvents'] != null) { - timeLineEvents = new List(); + timeLineEvents = []; json['TimeLineEvents'].forEach((v) { - timeLineEvents.add(new TimeLineEvents.fromJson(v)); + timeLineEvents!.add(new TimeLineEvents.fromJson(v)); }); } } @@ -109,26 +109,25 @@ class Timelines { data['ProjectName'] = this.projectName; data['SetupID'] = this.setupID; if (this.timeLineEvents != null) { - data['TimeLineEvents'] = - this.timeLineEvents.map((v) => v.toJson()).toList(); + data['TimeLineEvents'] = this.timeLineEvents!.map((v) => v.toJson()).toList(); } return data; } } class TimeLineEvents { - List admissions; - String colorClass; - List consulations; + List? admissions; + String? colorClass; + List? consulations; TimeLineEvents({this.admissions, this.colorClass, this.consulations}); TimeLineEvents.fromJson(Map json) { colorClass = json['ColorClass']; if (json['Consulations'] != null) { - consulations = new List(); + consulations = []; json['Consulations'].forEach((v) { - consulations.add(new Consulations.fromJson(v)); + consulations!.add(new Consulations.fromJson(v)); }); } } @@ -138,38 +137,38 @@ class TimeLineEvents { data['ColorClass'] = this.colorClass; if (this.consulations != null) { - data['Consulations'] = this.consulations.map((v) => v.toJson()).toList(); + data['Consulations'] = this.consulations!.map((v) => v.toJson()).toList(); } return data; } } class Consulations { - int admissionNo; - String appointmentDate; - int appointmentNo; - String appointmentType; - String clinicID; - String clinicName; - int doctorID; - String doctorName; - String endTime; - String episodeDate; - int episodeID; - int patientID; - int projectID; - String projectName; - String remarks; - String setupID; - String startTime; - String visitFor; - String visitType; - String dispalyName; - List lstAssessments; - List lstPhysicalExam; - List lstProcedure; - List lstMedicalHistory; - List lstCheifComplaint; + int? admissionNo; + String? appointmentDate; + int? appointmentNo; + String? appointmentType; + String? clinicID; + String? clinicName; + int? doctorID; + String? doctorName; + String? endTime; + String? episodeDate; + int? episodeID; + int? patientID; + int? projectID; + String? projectName; + String? remarks; + String? setupID; + String? startTime; + String? visitFor; + String? visitType; + String? dispalyName; + List? lstAssessments; + List? lstPhysicalExam; + List? lstProcedure; + List? lstMedicalHistory; + List? lstCheifComplaint; Consulations( {this.admissionNo, @@ -220,33 +219,33 @@ class Consulations { visitType = json['VisitType']; dispalyName = json['dispalyName']; if (json['lstAssessments'] != null) { - lstAssessments = new List(); + lstAssessments = []; json['lstAssessments'].forEach((v) { - lstAssessments.add(new LstAssessments.fromJson(v)); + lstAssessments!.add(new LstAssessments.fromJson(v)); }); } if (json['lstCheifComplaint'] != null) { - lstCheifComplaint = new List(); + lstCheifComplaint = []; json['lstCheifComplaint'].forEach((v) { - lstCheifComplaint.add(new LstCheifComplaint.fromJson(v)); + lstCheifComplaint!.add(new LstCheifComplaint.fromJson(v)); }); } if (json['lstPhysicalExam'] != null) { - lstPhysicalExam = new List(); + lstPhysicalExam = []; json['lstPhysicalExam'].forEach((v) { - lstPhysicalExam.add(new LstPhysicalExam.fromJson(v)); + lstPhysicalExam!.add(new LstPhysicalExam.fromJson(v)); }); } if (json['lstProcedure'] != null) { - lstProcedure = new List(); + lstProcedure = []; json['lstProcedure'].forEach((v) { - lstProcedure.add(new LstProcedure.fromJson(v)); + lstProcedure!.add(new LstProcedure.fromJson(v)); }); } if (json['lstMedicalHistory'] != null) { - lstMedicalHistory = new List(); + lstMedicalHistory = []; json['lstMedicalHistory'].forEach((v) { - lstMedicalHistory.add(new LstMedicalHistory.fromJson(v)); + lstMedicalHistory!.add(new LstMedicalHistory.fromJson(v)); }); } } @@ -274,41 +273,37 @@ class Consulations { data['VisitType'] = this.visitType; data['dispalyName'] = this.dispalyName; if (this.lstAssessments != null) { - data['lstAssessments'] = - this.lstAssessments.map((v) => v.toJson()).toList(); + data['lstAssessments'] = this.lstAssessments!.map((v) => v.toJson()).toList(); } if (this.lstCheifComplaint != null) { - data['lstCheifComplaint'] = - this.lstCheifComplaint.map((v) => v.toJson()).toList(); + data['lstCheifComplaint'] = this.lstCheifComplaint!.map((v) => v.toJson()).toList(); } if (this.lstPhysicalExam != null) { - data['lstPhysicalExam'] = - this.lstPhysicalExam.map((v) => v.toJson()).toList(); + data['lstPhysicalExam'] = this.lstPhysicalExam!.map((v) => v.toJson()).toList(); } if (this.lstProcedure != null) { - data['lstProcedure'] = this.lstProcedure.map((v) => v.toJson()).toList(); + data['lstProcedure'] = this.lstProcedure!.map((v) => v.toJson()).toList(); } if (this.lstMedicalHistory != null) { - data['lstMedicalHistory'] = - this.lstMedicalHistory.map((v) => v.toJson()).toList(); + data['lstMedicalHistory'] = this.lstMedicalHistory!.map((v) => v.toJson()).toList(); } return data; } } class LstCheifComplaint { - int appointmentNo; - String cCDate; - String chiefComplaint; - String currentMedication; - int episodeID; - String hOPI; - int patientID; - String patientType; - int projectID; - String projectName; - String setupID; - String dispalyName; + int? appointmentNo; + String? cCDate; + String? chiefComplaint; + String? currentMedication; + int? episodeID; + String? hOPI; + int? patientID; + String? patientType; + int? projectID; + String? projectName; + String? setupID; + String? dispalyName; LstCheifComplaint( {this.appointmentNo, @@ -358,19 +353,19 @@ class LstCheifComplaint { } class LstAssessments { - int appointmentNo; - String condition; - String description; - int episodeID; - String iCD10; - int patientID; - String patientType; - int projectID; - String projectName; - String remarks; - String setupID; - String type; - String dispalyName; + int? appointmentNo; + String? condition; + String? description; + int? episodeID; + String? iCD10; + int? patientID; + String? patientType; + int? projectID; + String? projectName; + String? remarks; + String? setupID; + String? type; + String? dispalyName; LstAssessments( {this.appointmentNo, @@ -423,19 +418,19 @@ class LstAssessments { } class LstPhysicalExam { - String abnormal; - int appointmentNo; - int episodeID; - String examDesc; - String examID; - String examType; - int patientID; - String patientType; - int projectID; - String projectName; - String remarks; - String setupID; - String dispalyName; + String? abnormal; + int? appointmentNo; + int? episodeID; + String? examDesc; + String? examID; + String? examType; + int? patientID; + String? patientType; + int? projectID; + String? projectName; + String? remarks; + String? setupID; + String? dispalyName; LstPhysicalExam( {this.abnormal, @@ -488,30 +483,20 @@ class LstPhysicalExam { } class LstProcedure { - int appointmentNo; - int episodeID; - String orderDate; - int patientID; - String patientType; - String procName; - String procedureId; - int projectID; - String projectName; - String setupID; - String dispalyName; + int? appointmentNo; + int? episodeID; + String? orderDate; + int? patientID; + String? patientType; + String? procName; + String? procedureId; + int? projectID; + String? projectName; + String? setupID; + String? dispalyName; LstProcedure( - {this.appointmentNo, - this.episodeID, - this.orderDate, - this.patientID, - this.patientType, - this.procName, - this.procedureId, - this.projectID, - this.projectName, - this.setupID, - this.dispalyName}); + {this.appointmentNo, this.episodeID, this.orderDate, this.patientID, this.patientType, this.procName, this.procedureId, this.projectID, this.projectName, this.setupID, this.dispalyName}); LstProcedure.fromJson(Map json) { appointmentNo = json['AppointmentNo']; @@ -545,30 +530,19 @@ class LstProcedure { } class LstMedicalHistory { - int appointmentNo; - String checked; - int episodeID; - String history; - int patientID; - String patientType; - int projectID; - String projectName; - String remarks; - String setupID; - String dispalyName; - - LstMedicalHistory( - {this.appointmentNo, - this.checked, - this.episodeID, - this.history, - this.patientID, - this.patientType, - this.projectID, - this.projectName, - this.remarks, - this.setupID, - this.dispalyName}); + int? appointmentNo; + String? checked; + int? episodeID; + String? history; + int? patientID; + String? patientType; + int? projectID; + String? projectName; + String? remarks; + String? setupID; + String? dispalyName; + + LstMedicalHistory({this.appointmentNo, this.checked, this.episodeID, this.history, this.patientID, this.patientType, this.projectID, this.projectName, this.remarks, this.setupID, this.dispalyName}); LstMedicalHistory.fromJson(Map json) { appointmentNo = json['AppointmentNo']; diff --git a/lib/core/model/medical_report/medical_file_request_model.dart b/lib/core/model/medical_report/medical_file_request_model.dart index b7fcb095..1709cfc9 100644 --- a/lib/core/model/medical_report/medical_file_request_model.dart +++ b/lib/core/model/medical_report/medical_file_request_model.dart @@ -1,10 +1,9 @@ class MedicalFileRequestModel { - int patientMRN; - String vidaAuthTokenID; - String iPAdress; + int? patientMRN; + String? vidaAuthTokenID; + String? iPAdress; - MedicalFileRequestModel( - {this.patientMRN, this.vidaAuthTokenID, this.iPAdress}); + MedicalFileRequestModel({this.patientMRN, this.vidaAuthTokenID, this.iPAdress}); MedicalFileRequestModel.fromJson(Map json) { patientMRN = json['PatientMRN']; diff --git a/lib/core/model/note/CreateNoteModel.dart b/lib/core/model/note/CreateNoteModel.dart index 20e27289..103eeea2 100644 --- a/lib/core/model/note/CreateNoteModel.dart +++ b/lib/core/model/note/CreateNoteModel.dart @@ -1,24 +1,24 @@ class CreateNoteModel { - int visitType; - int admissionNo; - int projectID; - int patientTypeID; - int patientID; - int clinicID; - String notes; - int createdBy; - int editedBy; - String nursingRemarks; - int languageID; - String stamp; - String iPAdress; - double versionID; - int channel; - String tokenID; - String sessionID; - bool isLoginForDoctorApp; - bool patientOutSA; - int conditionId; + int? visitType; + int? admissionNo; + int? projectID; + int? patientTypeID; + int? patientID; + int? clinicID; + String? notes; + int? createdBy; + int? editedBy; + String? nursingRemarks; + int? languageID; + String? stamp; + String? iPAdress; + double? versionID; + int? channel; + String? tokenID; + String? sessionID; + bool? isLoginForDoctorApp; + bool? patientOutSA; + int? conditionId; CreateNoteModel( {this.visitType, diff --git a/lib/core/model/note/GetNursingProgressNoteRequestModel.dart b/lib/core/model/note/GetNursingProgressNoteRequestModel.dart index 8cad6ea8..1eaa4647 100644 --- a/lib/core/model/note/GetNursingProgressNoteRequestModel.dart +++ b/lib/core/model/note/GetNursingProgressNoteRequestModel.dart @@ -1,9 +1,9 @@ class GetNursingProgressNoteRequestModel { - int patientID; - int admissionNo; - int patientTypeID; - int patientType; - String setupID; + int? patientID; + int? admissionNo; + int? patientTypeID; + int? patientType; + String? setupID; GetNursingProgressNoteRequestModel( {this.patientID, diff --git a/lib/core/model/note/GetNursingProgressNoteResposeModel.dart b/lib/core/model/note/GetNursingProgressNoteResposeModel.dart index fb7fbcec..5f5b8aac 100644 --- a/lib/core/model/note/GetNursingProgressNoteResposeModel.dart +++ b/lib/core/model/note/GetNursingProgressNoteResposeModel.dart @@ -1,14 +1,12 @@ class GetNursingProgressNoteResposeModel { - String notes; + String? notes; dynamic conditionType; - int createdBy; - String createdOn; + int? createdBy; + String? createdOn; dynamic editedBy; dynamic editedOn; - - String createdByName; - - String editedByName; + String? createdByName; + String? editedByName; GetNursingProgressNoteResposeModel( {this.notes, diff --git a/lib/core/model/note/note_model.dart b/lib/core/model/note/note_model.dart index bef3a973..268e814a 100644 --- a/lib/core/model/note/note_model.dart +++ b/lib/core/model/note/note_model.dart @@ -1,26 +1,27 @@ class NoteModel { - String setupID; - int projectID; - int patientID; - int patientType; - String admissionNo; - int lineItemNo; - int visitType; - String notes; - String assessmentDate; - String visitTime; - int status; - String nursingRemarks; - String createdOn; - String editedOn; - int createdBy; - int admissionClinicID; - String admissionClinicName; - Null doctorClinicName; - String doctorName; - String visitTypeDesc; - int condition; - String conditionDescription; + String? setupID; + int? projectID; + int? patientID; + int? patientType; + String? admissionNo; + int? lineItemNo; + int? visitType; + String? notes; + String? assessmentDate; + String? visitTime; + int? status; + String? nursingRemarks; + String? createdOn; + String? editedOn; + int? createdBy; + int? admissionClinicID; + String? admissionClinicName; + dynamic doctorClinicName; + String? doctorName; + String? visitTypeDesc; + int? condition; + String? conditionDescription; + NoteModel( {this.setupID, diff --git a/lib/core/model/note/stp_master_list_req_model.dart b/lib/core/model/note/stp_master_list_req_model.dart index 067a1623..8031d5f2 100644 --- a/lib/core/model/note/stp_master_list_req_model.dart +++ b/lib/core/model/note/stp_master_list_req_model.dart @@ -1,9 +1,9 @@ class StpMasterListRequestModel { - bool isDentalAllowedBackend; - int languageID; - int projectID; - int parameterGroup; - int parameterType; + bool? isDentalAllowedBackend; + int? languageID; + int? projectID; + int? parameterGroup; + int? parameterType; StpMasterListRequestModel( {this.isDentalAllowedBackend, diff --git a/lib/core/model/note/stp_master_list_res_model.dart b/lib/core/model/note/stp_master_list_res_model.dart index 2533605a..38a653a2 100644 --- a/lib/core/model/note/stp_master_list_res_model.dart +++ b/lib/core/model/note/stp_master_list_res_model.dart @@ -1,7 +1,7 @@ class StpMasterListResponseModel { - int parameterCode; - String description; - Null descriptionN; + int? parameterCode; + String? description; + dynamic descriptionN; StpMasterListResponseModel( {this.parameterCode, this.description, this.descriptionN}); diff --git a/lib/core/model/note/update_note_model.dart b/lib/core/model/note/update_note_model.dart index faedb6f7..c662976a 100644 --- a/lib/core/model/note/update_note_model.dart +++ b/lib/core/model/note/update_note_model.dart @@ -1,22 +1,23 @@ class UpdateNoteReqModel { - int projectID; - int createdBy; - int admissionNo; - int lineItemNo; - String notes; - bool verifiedNote; - bool cancelledNote; - int languageID; - String stamp; - String iPAdress; - double versionID; - int channel; - String tokenID; - String sessionID; - bool isLoginForDoctorApp; - bool patientOutSA; - int patientTypeID; - int conditionId; + int? projectID; + int? createdBy; + int? admissionNo; + int? lineItemNo; + String? notes; + bool? verifiedNote; + bool? cancelledNote; + int? languageID; + String? stamp; + String? iPAdress; + double? versionID; + int? channel; + String? tokenID; + String? sessionID; + bool? isLoginForDoctorApp; + bool? patientOutSA; + int? patientTypeID; + int? conditionId; + UpdateNoteReqModel( {this.projectID, diff --git a/lib/core/model/operation_report/create_update_operation_report_request_model.dart b/lib/core/model/operation_report/create_update_operation_report_request_model.dart index 1bc6d51e..cecbce0b 100644 --- a/lib/core/model/operation_report/create_update_operation_report_request_model.dart +++ b/lib/core/model/operation_report/create_update_operation_report_request_model.dart @@ -1,28 +1,28 @@ class CreateUpdateOperationReportRequestModel { - String setupID; - int patientID; - int reservationNo; - int admissionNo; - String preOpDiagmosis; - String postOpDiagmosis; - String surgeon; - String assistant; - String anasthetist; - String operation; - String inasion; - String finding; - String surgeryProcedure; - String postOpInstruction; - int createdBy; - int editedBy; - String complicationDetails; - String bloodLossDetail; - String histopathSpecimen; - String microbiologySpecimen; - String otherSpecimen; - String scrubNurse; - String circulatingNurse; - String bloodTransfusedDetail; + String? setupID; + int? patientID; + int? reservationNo; + int? admissionNo; + String? preOpDiagmosis; + String? postOpDiagmosis; + String? surgeon; + String? assistant; + String? anasthetist; + String? operation; + String? inasion; + String? finding; + String? surgeryProcedure; + String? postOpInstruction; + int? createdBy; + int? editedBy; + String? complicationDetails; + String? bloodLossDetail; + String? histopathSpecimen; + String? microbiologySpecimen; + String? otherSpecimen; + String? scrubNurse; + String? circulatingNurse; + String? bloodTransfusedDetail; CreateUpdateOperationReportRequestModel( {this.setupID, diff --git a/lib/core/model/operation_report/get_operation_details_request_modle.dart b/lib/core/model/operation_report/get_operation_details_request_modle.dart index 6c8e27fd..fd7be8a4 100644 --- a/lib/core/model/operation_report/get_operation_details_request_modle.dart +++ b/lib/core/model/operation_report/get_operation_details_request_modle.dart @@ -1,18 +1,18 @@ class GetOperationDetailsRequestModel { - bool isDentalAllowedBackend; - double versionID; - int channel; - int languageID; - String iPAdress; - String generalid; - int deviceTypeID; - String tokenID; - int patientID; - int reservationNo; - String sessionID; - int projectID; - String setupID; - bool patientOutSA; + bool? isDentalAllowedBackend; + double? versionID; + int? channel; + int? languageID; + String? iPAdress; + String? generalid; + int? deviceTypeID; + String? tokenID; + int? patientID; + int? reservationNo; + String? sessionID; + int? projectID; + String? setupID; + bool? patientOutSA; GetOperationDetailsRequestModel( {this.isDentalAllowedBackend = false, diff --git a/lib/core/model/operation_report/get_operation_details_response_modle.dart b/lib/core/model/operation_report/get_operation_details_response_modle.dart index f050eca3..b53b2867 100644 --- a/lib/core/model/operation_report/get_operation_details_response_modle.dart +++ b/lib/core/model/operation_report/get_operation_details_response_modle.dart @@ -1,39 +1,40 @@ class GetOperationDetailsResponseModel { - String setupID; - int projectID; - int reservationNo; - int patientID; - int admissionID; + String? setupID; + int? projectID; + int? reservationNo; + int? patientID; + int? admissionID; dynamic surgeryDate; - String preOpDiagnosis; - String postOpDiagnosis; - String surgeon; - String assistant; - String anasthetist; - String operation; - String inasion; - String finding; - String surgeryProcedure; - String postOpInstruction; - bool isActive; - int createdBy; - String createdName; + String? preOpDiagnosis; + String? postOpDiagnosis; + String? surgeon; + String? assistant; + String? anasthetist; + String? operation; + String? inasion; + String? finding; + String? surgeryProcedure; + String? postOpInstruction; + bool? isActive; + int? createdBy; + String? createdName; dynamic createdNameN; - String createdOn; + String? createdOn; dynamic editedBy; dynamic editedByName; dynamic editedByNameN; dynamic editedOn; dynamic oRBookStatus; - String complicationDetail; - String bloodLossDetail; - String histopathSpecimen; - String microbiologySpecimen; - String otherSpecimen; + String? complicationDetail; + String? bloodLossDetail; + String? histopathSpecimen; + String? microbiologySpecimen; + String? otherSpecimen; dynamic scrubNurse; dynamic circulatingNurse; dynamic bloodTransfusedDetail; + GetOperationDetailsResponseModel( {this.setupID, this.projectID, diff --git a/lib/core/model/operation_report/get_reservations_request_model.dart b/lib/core/model/operation_report/get_reservations_request_model.dart index 06425254..8de0bbf3 100644 --- a/lib/core/model/operation_report/get_reservations_request_model.dart +++ b/lib/core/model/operation_report/get_reservations_request_model.dart @@ -1,17 +1,17 @@ class GetReservationsRequestModel { - int patientID; - int projectID; - String doctorID; - int clinicID; - double versionID; - int channel; - int languageID; - String iPAdress; - String generalid; - bool patientOutSA; - int deviceTypeID; - String tokenID; - String sessionID; + int? patientID; + int? projectID; + String? doctorID; + int? clinicID; + double? versionID; + int? channel; + int? languageID; + String? iPAdress; + String? generalid; + bool? patientOutSA; + int? deviceTypeID; + String? tokenID; + String? sessionID; GetReservationsRequestModel( {this.patientID, diff --git a/lib/core/model/operation_report/get_reservations_response_model.dart b/lib/core/model/operation_report/get_reservations_response_model.dart index 3bebdc8b..afc26779 100644 --- a/lib/core/model/operation_report/get_reservations_response_model.dart +++ b/lib/core/model/operation_report/get_reservations_response_model.dart @@ -1,39 +1,40 @@ class GetReservationsResponseModel { - String setupID; - int projectID; - int oTReservationID; - String oTReservationDate; - String oTReservationDateN; - int oTID; - int admissionRequestNo; - int admissionNo; - int primaryDoctorID; - int patientType; - int patientID; - int patientStatusType; - int clinicID; - int doctorID; - String operationDate; - int operationType; - String endDate; - String timeStart; - String timeEnd; + String? setupID; + int? projectID; + int? oTReservationID; + String? oTReservationDate; + String? oTReservationDateN; + int? oTID; + int? admissionRequestNo; + int? admissionNo; + int? primaryDoctorID; + int? patientType; + int? patientID; + int? patientStatusType; + int? clinicID; + int? doctorID; + String? operationDate; + int? operationType; + String? endDate; + String? timeStart; + String? timeEnd; dynamic remarks; - int status; - int createdBy; - String createdOn; - int editedBy; - String editedOn; - String patientName; - Null patientNameN; - Null gender; - String dateofBirth; - String mobileNumber; - String emailAddress; - String doctorName; - Null doctorNameN; - String clinicDescription; - Null clinicDescriptionN; + int? status; + int? createdBy; + String? createdOn; + int? editedBy; + String? editedOn; + String? patientName; + String? patientNameN; + String? gender; + String? dateofBirth; + String? mobileNumber; + String? emailAddress; + String? doctorName; + String? doctorNameN; + String? clinicDescription; + String? clinicDescriptionN; + GetReservationsResponseModel( {this.setupID, diff --git a/lib/core/model/patient/MedicalReport/MedicalReportTemplate.dart b/lib/core/model/patient/MedicalReport/MedicalReportTemplate.dart index f847c9d5..4c71dda8 100644 --- a/lib/core/model/patient/MedicalReport/MedicalReportTemplate.dart +++ b/lib/core/model/patient/MedicalReport/MedicalReportTemplate.dart @@ -1,16 +1,16 @@ class MedicalReportTemplate { - String setupID; - int projectID; - int templateID; - String procedureID; - int reportType; - String templateName; - String templateNameN; - String templateText; - String templateTextN; - bool isActive; - String templateTextHtml; - String templateTextNHtml; + String? setupID; + int? projectID; + int? templateID; + String? procedureID; + int? reportType; + String? templateName; + String? templateNameN; + String? templateText; + String? templateTextN; + bool? isActive; + String? templateTextHtml; + String? templateTextNHtml; MedicalReportTemplate( {this.setupID, diff --git a/lib/core/model/patient/MedicalReport/MeidcalReportModel.dart b/lib/core/model/patient/MedicalReport/MeidcalReportModel.dart index 1fe7609b..ae101a10 100644 --- a/lib/core/model/patient/MedicalReport/MeidcalReportModel.dart +++ b/lib/core/model/patient/MedicalReport/MeidcalReportModel.dart @@ -1,30 +1,30 @@ class MedicalReportModel { - String reportData; - String setupID; - int projectID; - String projectName; - String projectNameN; - int patientID; - String invoiceNo; - int status; - String verifiedOn; + String? reportData; + String? setupID; + int? projectID; + String? projectName; + String? projectNameN; + int? patientID; + String? invoiceNo; + int? status; + String? verifiedOn; dynamic verifiedBy; - String editedOn; - int editedBy; - int lineItemNo; - String createdOn; - int templateID; - int doctorID; - int doctorGender; - String doctorGenderDescription; - String doctorGenderDescriptionN; - String doctorImageURL; - String doctorName; - String doctorNameN; - int clinicID; - String clinicName; - String clinicNameN; - String reportDataHtml; + String? editedOn; + int? editedBy; + int? lineItemNo; + String? createdOn; + int? templateID; + int? doctorID; + int? doctorGender; + String? doctorGenderDescription; + String? doctorGenderDescriptionN; + String? doctorImageURL; + String? doctorName; + String? doctorNameN; + int? clinicID; + String? clinicName; + String? clinicNameN; + String? reportDataHtml; MedicalReportModel( {this.reportData, diff --git a/lib/core/model/patient/lab_orders/lab_orders_req_model.dart b/lib/core/model/patient/lab_orders/lab_orders_req_model.dart index 29928f4e..4f2b9c1d 100644 --- a/lib/core/model/patient/lab_orders/lab_orders_req_model.dart +++ b/lib/core/model/patient/lab_orders/lab_orders_req_model.dart @@ -1,23 +1,17 @@ -/* - *@author: Elham Rababah - *@Date:6/5/2020 - *@param: - *@return:LabOrdersReqModel - *@desc: LabOrdersReqModel class - */ + class LabOrdersReqModel { - int patientID; - int patientTypeID; - int projectID; - int languageID; - String stamp; - String iPAdress; - double versionID; - int channel; - String tokenID; - String sessionID; - bool isLoginForDoctorApp; - bool patientOutSA; + int? patientID; + int? patientTypeID; + int? projectID; + int? languageID; + String? stamp; + String? iPAdress; + double? versionID; + int? channel; + String? tokenID; + String? sessionID; + bool? isLoginForDoctorApp; + bool? patientOutSA; LabOrdersReqModel( {this.patientID, diff --git a/lib/core/model/patient/lab_orders/lab_orders_res_model.dart b/lib/core/model/patient/lab_orders/lab_orders_res_model.dart index 4d904693..1aac98f1 100644 --- a/lib/core/model/patient/lab_orders/lab_orders_res_model.dart +++ b/lib/core/model/patient/lab_orders/lab_orders_res_model.dart @@ -1,27 +1,27 @@ import 'package:doctor_app_flutter/utils/date-utils.dart'; class LabOrdersResModel { - String setupID; - int projectID; - int patientID; - int patientType; - int orderNo; - String orderDate; - int invoiceTransactionType; - int invoiceNo; - int clinicId; - int doctorId; - int status; - String createdBy; - Null createdByN; - DateTime createdOn; - String editedBy; - Null editedByN; - String editedOn; - String clinicName; - String doctorImageURL; - String doctorName; - String projectName; + String? setupID; + int? projectID; + int? patientID; + int? patientType; + int? orderNo; + String? orderDate; + int? invoiceTransactionType; + int? invoiceNo; + int? clinicId; + int? doctorId; + int? status; + String? createdBy; + dynamic createdByN; + DateTime? createdOn; + String? editedBy; + dynamic editedByN; + String? editedOn; + String? clinicName; + String? doctorImageURL; + String? doctorName; + String? projectName; LabOrdersResModel( {this.setupID, diff --git a/lib/core/model/patient/lab_result/lab_result.dart b/lib/core/model/patient/lab_result/lab_result.dart index 30925f12..f083a6d3 100644 --- a/lib/core/model/patient/lab_result/lab_result.dart +++ b/lib/core/model/patient/lab_result/lab_result.dart @@ -1,32 +1,32 @@ class LabResult { - String setupID; - int projectID; - int orderNo; - int lineItemNo; - int packageID; - int testID; - String description; - String resultValue; - String referenceRange; - Null convertedResultValue; - Null convertedReferenceRange; - Null resultValueFlag; - int status; - String createdBy; - Null createdByN; - String createdOn; - String editedBy; - Null editedByN; - String editedOn; - String verifiedBy; - Null verifiedByN; - String verifiedOn; - Null patientID; - int gender; - Null maleInterpretativeData; - Null femaleInterpretativeData; - String testCode; - String statusDescription; + String? setupID; + int? projectID; + int? orderNo; + int? lineItemNo; + int? packageID; + int? testID; + String? description; + String? resultValue; + String? referenceRange; + dynamic convertedResultValue; + dynamic convertedReferenceRange; + dynamic resultValueFlag; + int? status; + String? createdBy; + dynamic createdByN; + String? createdOn; + String? editedBy; + dynamic editedByN; + String? editedOn; + String? verifiedBy; + dynamic verifiedByN; + String? verifiedOn; + dynamic patientID; + int? gender; + dynamic maleInterpretativeData; + dynamic femaleInterpretativeData; + String? testCode; + String? statusDescription; LabResult( {this.setupID, @@ -90,7 +90,7 @@ class LabResult { } Map toJson() { - final Map data = new Map(); + final Map data = Map(); data['SetupID'] = this.setupID; data['ProjectID'] = this.projectID; data['OrderNo'] = this.orderNo; diff --git a/lib/core/model/patient/lab_result/lab_result_req_model.dart b/lib/core/model/patient/lab_result/lab_result_req_model.dart index f070d4c2..e046e99d 100644 --- a/lib/core/model/patient/lab_result/lab_result_req_model.dart +++ b/lib/core/model/patient/lab_result/lab_result_req_model.dart @@ -1,18 +1,18 @@ class RequestLabResult { - int projectID; - String setupID; - int orderNo; - int invoiceNo; - int patientTypeID; - int languageID; - String stamp; - String iPAdress; - double versionID; - int channel; - String tokenID; - String sessionID; - bool isLoginForDoctorApp; - bool patientOutSA; + int? projectID; + String? setupID; + int? orderNo; + int? invoiceNo; + int? patientTypeID; + int? languageID; + String? stamp; + String? iPAdress; + double? versionID; + int? channel; + String? tokenID; + String? sessionID; + bool? isLoginForDoctorApp; + bool? patientOutSA; RequestLabResult( {this.projectID, @@ -30,7 +30,7 @@ class RequestLabResult { this.isLoginForDoctorApp, this.patientOutSA}); - RequestLabResult.fromJson(Map json) { + RequestLabResult.fromJson(Map json) { projectID = json['ProjectID']; setupID = json['SetupID']; orderNo = json['OrderNo']; @@ -48,7 +48,7 @@ class RequestLabResult { } Map toJson() { - final Map data = new Map(); + final Map data = Map(); data['ProjectID'] = this.projectID; data['SetupID'] = this.setupID; data['OrderNo'] = this.orderNo; diff --git a/lib/core/model/patient/my_referral/PendingReferral.dart b/lib/core/model/patient/my_referral/PendingReferral.dart index 6d3f0b83..fab3ea40 100644 --- a/lib/core/model/patient/my_referral/PendingReferral.dart +++ b/lib/core/model/patient/my_referral/PendingReferral.dart @@ -1,37 +1,37 @@ import '../patiant_info_model.dart'; class PendingReferral { - PatiantInformtion patientDetails; - String doctorImageUrl; - String nationalityFlagUrl; - String responded; - String answerFromTarget; - String createdOn; - int data; - int isSameBranch; - String editedOn; - int interBranchReferral; - int patientID; - String patientName; - int patientType; - int referralNo; - String referralStatus; - String referredByDoctorInfo; - String referredFromBranchName; - String referredOn; - String referredType; - String remarksFromSource; - String respondedOn; - int sourceAppointmentNo; - int sourceProjectId; - String sourceSetupID; - String startDate; - int targetAppointmentNo; - String targetClinicID; - String targetDoctorID; - int targetProjectId; - String targetSetupID; - bool isReferralDoctorSameBranch; + PatiantInformtion? patientDetails; + String? doctorImageUrl; + String? nationalityFlagUrl; + String? responded; + String? answerFromTarget; + String? createdOn; + int? data; + int? isSameBranch; + String? editedOn; + int? interBranchReferral; + int? patientID; + String? patientName; + int? patientType; + int? referralNo; + String? referralStatus; + String? referredByDoctorInfo; + String? referredFromBranchName; + String? referredOn; + String? referredType; + String? remarksFromSource; + String? respondedOn; + int? sourceAppointmentNo; + int? sourceProjectId; + String? sourceSetupID; + String? startDate; + int? targetAppointmentNo; + String? targetClinicID; + String? targetDoctorID; + int? targetProjectId; + String? targetSetupID; + bool? isReferralDoctorSameBranch; PendingReferral({ this.patientDetails, @@ -68,9 +68,7 @@ class PendingReferral { }); PendingReferral.fromJson(Map json) { - patientDetails = json['patientDetails'] != null - ? PatiantInformtion.fromJson(json['patientDetails']) - : null; + patientDetails = json['patientDetails'] != null ? PatiantInformtion.fromJson(json['patientDetails']) : null; doctorImageUrl = json['DoctorImageURL']; nationalityFlagUrl = json['NationalityFlagURL']; responded = json['Responded']; diff --git a/lib/core/model/patient/my_referral/clinic-doctor.dart b/lib/core/model/patient/my_referral/clinic-doctor.dart index 0679f4c8..49f62f7d 100644 --- a/lib/core/model/patient/my_referral/clinic-doctor.dart +++ b/lib/core/model/patient/my_referral/clinic-doctor.dart @@ -1,43 +1,44 @@ class ClinicDoctor { - int clinicID; - String clinicName; - String doctorTitle; - int iD; - String name; - int projectID; - String projectName; - int actualDoctorRate; - int clinicRoomNo; - String date; - String dayName; - int doctorID; - String doctorImageURL; - String doctorProfile; - String doctorProfileInfo; - int doctorRate; - int gender; - String genderDescription; - bool isAppointmentAllowed; - bool isDoctorAllowVedioCall; - bool isDoctorDummy; - bool isLiveCare; - String latitude; - String longitude; - String nationalityFlagURL; - String nationalityID; - String nationalityName; - String nearestFreeSlot; - int noOfPatientsRate; - String originalClinicID; - int personRate; - int projectDistanceInKiloMeters; - String qR; - String qRString; - int rateNumber; - String serviceID; - String setupID; - List speciality; - String workingHours; + int? clinicID; + String? clinicName; + String? doctorTitle; + int? iD; + String? name; + int? projectID; + String? projectName; + int? actualDoctorRate; + int? clinicRoomNo; + String? date; + String? dayName; + int? doctorID; + String? doctorImageURL; + String? doctorProfile; + String? doctorProfileInfo; + int? doctorRate; + int? gender; + String? genderDescription; + bool? isAppointmentAllowed; + bool? isDoctorAllowVedioCall; + bool? isDoctorDummy; + bool? isLiveCare; + String? latitude; + String? longitude; + String? nationalityFlagURL; + String? nationalityID; + String? nationalityName; + String? nearestFreeSlot; + int? noOfPatientsRate; + String? originalClinicID; + int? personRate; + int? projectDistanceInKiloMeters; + String? qR; + String? qRString; + int? rateNumber; + String? serviceID; + String? setupID; + List? speciality; + String? workingHours; + ClinicDoctor( {this.clinicID, diff --git a/lib/core/model/patient/my_referral/my_referral_patient_model.dart b/lib/core/model/patient/my_referral/my_referral_patient_model.dart index f0dd5fd3..23741434 100644 --- a/lib/core/model/patient/my_referral/my_referral_patient_model.dart +++ b/lib/core/model/patient/my_referral/my_referral_patient_model.dart @@ -1,55 +1,55 @@ import 'package:doctor_app_flutter/utils/date-utils.dart'; class MyReferralPatientModel { - int projectID; - int lineItemNo; - int doctorID; - int patientID; - String doctorName; - String doctorNameN; - String firstName; - String middleName; - String lastName; - String firstNameN; - String middleNameN; - String lastNameN; - int gender; - String dateofBirth; - String mobileNumber; - String emailAddress; - String patientIdentificationNo; - int patientType; - String admissionNo; - String admissionDate; - String roomID; - String bedID; - String nursingStationID; - String description; - String nationalityName; - String nationalityNameN; - String clinicDescription; - String clinicDescriptionN; - int referralDoctor; - int referringDoctor; - int referralClinic; - int referringClinic; - int referralStatus; - String referralDate; - String referringDoctorRemarks; - String referredDoctorRemarks; - String referralResponseOn; - int priority; - int frequency; - DateTime mAXResponseTime; - String age; - String frequencyDescription; - String genderDescription; - bool isDoctorLate; - bool isDoctorResponse; - String nursingStationName; - String priorityDescription; - String referringClinicDescription; - String referringDoctorName; + int? projectID; + int? lineItemNo; + int? doctorID; + int? patientID; + String? doctorName; + String? doctorNameN; + String? firstName; + String? middleName; + String? lastName; + String? firstNameN; + String? middleNameN; + String? lastNameN; + int? gender; + String? dateofBirth; + String? mobileNumber; + String? emailAddress; + String? patientIdentificationNo; + int? patientType; + String? admissionNo; + String? admissionDate; + String? roomID; + String? bedID; + String? nursingStationID; + String? description; + String? nationalityName; + String? nationalityNameN; + String? clinicDescription; + String? clinicDescriptionN; + int? referralDoctor; + int? referringDoctor; + int? referralClinic; + int? referringClinic; + int? referralStatus; + String? referralDate; + String? referringDoctorRemarks; + String? referredDoctorRemarks; + String? referralResponseOn; + int? priority; + int? frequency; + DateTime? mAXResponseTime; + String? age; + String? frequencyDescription; + String? genderDescription; + bool? isDoctorLate; + bool? isDoctorResponse; + String? nursingStationName; + String? priorityDescription; + String? referringClinicDescription; + String? referringDoctorName; MyReferralPatientModel( {this.projectID, diff --git a/lib/core/model/patient/my_referral/my_referred_patient_model.dart b/lib/core/model/patient/my_referral/my_referred_patient_model.dart index 4f9aabad..51482fed 100644 --- a/lib/core/model/patient/my_referral/my_referred_patient_model.dart +++ b/lib/core/model/patient/my_referral/my_referred_patient_model.dart @@ -1,68 +1,68 @@ class MyReferredPatientModel { - String rowID; - int projectID; - int lineItemNo; - int doctorID; - int patientID; - String doctorName; - String doctorNameN; - String firstName; - String middleName; - String lastName; - String firstNameN; - String middleNameN; - String lastNameN; - int gender; - String dateofBirth; - String mobileNumber; - String emailAddress; - String patientIdentificationNo; - int patientType; - String admissionNo; - String admissionDate; - String roomID; - String bedID; - String nursingStationID; - String description; - String nationalityName; - String nationalityNameN; - String clinicDescription; - String clinicDescriptionN; - int referralDoctor; - int referringDoctor; - int referralClinic; - int referringClinic; - int referralStatus; - String referralDate; - String referringDoctorRemarks; - String referredDoctorRemarks; - String referralResponseOn; - int priority; - int frequency; - String mAXResponseTime; - int episodeID; - int appointmentNo; - String appointmentDate; - int appointmentType; - int patientMRN; - String createdOn; - int clinicID; - String nationalityID; - String age; - String doctorImageURL; - String frequencyDescription; - String genderDescription; - bool isDoctorLate; - bool isDoctorResponse; - String nationalityFlagURL; - String nursingStationName; - String priorityDescription; - String referringClinicDescription; - String referralDoctorName; - String referralClinicDescription; - String referringDoctorName; - bool isReferralDoctorSameBranch; - String referralStatusDesc; + String? rowID; + int? projectID; + int? lineItemNo; + int? doctorID; + int? patientID; + String? doctorName; + String? doctorNameN; + String? firstName; + String? middleName; + String? lastName; + String? firstNameN; + String? middleNameN; + String? lastNameN; + int? gender; + String? dateofBirth; + String? mobileNumber; + String? emailAddress; + String? patientIdentificationNo; + int? patientType; + String? admissionNo; + String? admissionDate; + String? roomID; + String? bedID; + String? nursingStationID; + String? description; + String? nationalityName; + String? nationalityNameN; + String? clinicDescription; + String? clinicDescriptionN; + int? referralDoctor; + int? referringDoctor; + int? referralClinic; + int? referringClinic; + int? referralStatus; + String? referralDate; + String? referringDoctorRemarks; + String? referredDoctorRemarks; + String? referralResponseOn; + int? priority; + int? frequency; + String? mAXResponseTime; + int? episodeID; + int? appointmentNo; + String? appointmentDate; + int? appointmentType; + int? patientMRN; + String? createdOn; + int? clinicID; + String? nationalityID; + String? age; + String? doctorImageURL; + String? frequencyDescription; + String? genderDescription; + bool? isDoctorLate; + bool? isDoctorResponse; + String? nationalityFlagURL; + String? nursingStationName; + String? priorityDescription; + String? referringClinicDescription; + String? referralDoctorName; + String? referralClinicDescription; + String? referringDoctorName; + bool? isReferralDoctorSameBranch; + String? referralStatusDesc; MyReferredPatientModel( {this.rowID, diff --git a/lib/core/model/patient/patient_arrival/get_patient_arrival_list_request_model.dart b/lib/core/model/patient/patient_arrival/get_patient_arrival_list_request_model.dart index 5ec16352..f5126bb9 100644 --- a/lib/core/model/patient/patient_arrival/get_patient_arrival_list_request_model.dart +++ b/lib/core/model/patient/patient_arrival/get_patient_arrival_list_request_model.dart @@ -1,22 +1,14 @@ class GetPatientArrivalListRequestModel { - String vidaAuthTokenID; - String from; - String to; - String doctorID; - int pageIndex; - int pageSize; - int clinicID; - int patientMRN; + String? vidaAuthTokenID; + String? from; + String? to; + String? doctorID; + int? pageIndex; + int? pageSize; + int? clinicID; + int? patientMRN; - GetPatientArrivalListRequestModel( - {this.vidaAuthTokenID, - this.from, - this.to, - this.doctorID, - this.pageIndex, - this.pageSize, - this.clinicID, - this.patientMRN}); + GetPatientArrivalListRequestModel({this.vidaAuthTokenID, this.from, this.to, this.doctorID, this.pageIndex, this.pageSize, this.clinicID, this.patientMRN}); GetPatientArrivalListRequestModel.fromJson(Map json) { vidaAuthTokenID = json['VidaAuthTokenID']; diff --git a/lib/core/model/patient/prescription/prescription_report.dart b/lib/core/model/patient/prescription/prescription_report.dart index d559b9d0..455982f0 100644 --- a/lib/core/model/patient/prescription/prescription_report.dart +++ b/lib/core/model/patient/prescription/prescription_report.dart @@ -1,36 +1,36 @@ class PrescriptionReport { - String address; - int appointmentNo; - String clinic; - String companyName; - int days; - String doctorName; - int doseDailyQuantity; - String frequency; - int frequencyNumber; - Null imageExtension; - Null imageSRCUrl; - Null imageString; - Null imageThumbUrl; - String isCovered; - String itemDescription; - int itemID; - String orderDate; - int patientID; - String patientName; - String phoneOffice1; - Null prescriptionQR; - int prescriptionTimes; - Null productImage; - String productImageBase64; - String productImageString; - int projectID; - String projectName; - String remarks; - String route; - String sKU; - int scaleOffset; - String startDate; + String? address; + int? appointmentNo; + String? clinic; + String? companyName; + int? days; + String? doctorName; + int? doseDailyQuantity; + String? frequency; + int? frequencyNumber; + dynamic imageExtension; + dynamic imageSRCUrl; + dynamic imageString; + dynamic imageThumbUrl; + String? isCovered; + String? itemDescription; + int? itemID; + String? orderDate; + int? patientID; + String? patientName; + String? phoneOffice1; + dynamic prescriptionQR; + int? prescriptionTimes; + dynamic productImage; + String? productImageBase64; + String? productImageString; + int? projectID; + String? projectName; + String? remarks; + String? route; + String? sKU; + int? scaleOffset; + String? startDate; PrescriptionReport( {this.address, diff --git a/lib/core/model/patient/prescription/prescription_report_for_in_patient.dart b/lib/core/model/patient/prescription/prescription_report_for_in_patient.dart index c045d656..3f4f7a74 100644 --- a/lib/core/model/patient/prescription/prescription_report_for_in_patient.dart +++ b/lib/core/model/patient/prescription/prescription_report_for_in_patient.dart @@ -1,53 +1,53 @@ import 'package:doctor_app_flutter/utils/date-utils.dart'; class PrescriptionReportForInPatient { - int admissionNo; - int authorizedBy; - Null bedNo; - String comments; - int createdBy; - String createdByName; - Null createdByNameN; - String createdOn; - String direction; - int directionID; - Null directionN; - String dose; - int editedBy; - Null iVDiluentLine; - int iVDiluentType; - Null iVDiluentVolume; - Null iVRate; - Null iVStability; - String itemDescription; - int itemID; - int lineItemNo; - int locationId; - int noOfDoses; - int orderNo; - int patientID; - String pharmacyRemarks; - DateTime prescriptionDatetime; - int prescriptionNo; - String processedBy; - int projectID; - int refillID; - String refillType; - Null refillTypeN; - int reviewedPharmacist; - Null roomId; - String route; - int routeId; - Null routeN; - Null setupID; - DateTime startDatetime; - int status; - String statusDescription; - Null statusDescriptionN; - DateTime stopDatetime; - int unitofMeasurement; - String unitofMeasurementDescription; - Null unitofMeasurementDescriptionN; + int? admissionNo; + int? authorizedBy; + dynamic bedNo; + String? comments; + int? createdBy; + String? createdByName; + dynamic createdByNameN; + String? createdOn; + String? direction; + int? directionID; + dynamic directionN; + String? dose; + int? editedBy; + dynamic iVDiluentLine; + int? iVDiluentType; + dynamic iVDiluentVolume; + dynamic iVRate; + dynamic iVStability; + String? itemDescription; + int? itemID; + int? lineItemNo; + int? locationId; + int? noOfDoses; + int? orderNo; + int? patientID; + String? pharmacyRemarks; + DateTime? prescriptionDatetime; + int? prescriptionNo; + String? processedBy; + int? projectID; + int? refillID; + String? refillType; + dynamic refillTypeN; + int? reviewedPharmacist; + dynamic roomId; + String? route; + int? routeId; + dynamic routeN; + dynamic setupID; + DateTime? startDatetime; + int? status; + String? statusDescription; + dynamic statusDescriptionN; + DateTime? stopDatetime; + int? unitofMeasurement; + String? unitofMeasurementDescription; + dynamic unitofMeasurementDescriptionN; PrescriptionReportForInPatient( {this.admissionNo, diff --git a/lib/core/model/patient/prescription/prescription_req_model.dart b/lib/core/model/patient/prescription/prescription_req_model.dart index 9141c282..6c775497 100644 --- a/lib/core/model/patient/prescription/prescription_req_model.dart +++ b/lib/core/model/patient/prescription/prescription_req_model.dart @@ -1,24 +1,17 @@ -/* - *@author: Elham Rababah - *@Date:6/5/2020 - *@param: - *@return:PrescriptionReqModel - *@desc: PrescriptionReqModel class - */ class PrescriptionReqModel { - int patientID; - int setupID; - int projectID; - int languageID; - String stamp; - String iPAdress; - double versionID; - int channel; - String tokenID; - String sessionID; - bool isLoginForDoctorApp; - bool patientOutSA; - int patientTypeID; + int? patientID; + int? setupID; + int? projectID; + int? languageID; + String? stamp; + String? iPAdress; + double? versionID; + int? channel; + String? tokenID; + String? sessionID; + bool? isLoginForDoctorApp; + bool? patientOutSA; + int? patientTypeID; PrescriptionReqModel( {this.patientID, diff --git a/lib/core/model/patient/prescription/prescription_res_model.dart b/lib/core/model/patient/prescription/prescription_res_model.dart index eed34296..0c42b6fd 100644 --- a/lib/core/model/patient/prescription/prescription_res_model.dart +++ b/lib/core/model/patient/prescription/prescription_res_model.dart @@ -1,43 +1,36 @@ -/* - *@author: Elham Rababah - *@Date:6/5/2020 - *@param: - *@return:PrescriptionResModel - *@desc: PrescriptionResModel class - */ class PrescriptionResModel { - String setupID; - int projectID; - int patientID; - int appointmentNo; - String appointmentDate; - String doctorName; - String clinicDescription; - String name; - int episodeID; - int actualDoctorRate; - int clinicID; - String companyName; - String despensedStatus; - String dischargeDate; - int dischargeNo; - int doctorID; - String doctorImageURL; - int doctorRate; - String doctorTitle; - int gender; - String genderDescription; - bool isActiveDoctorProfile; - bool isDoctorAllowVedioCall; - bool isExecludeDoctor; - bool isInOutPatient; - String isInOutPatientDescription; - String isInOutPatientDescriptionN; - bool isInsurancePatient; - String nationalityFlagURL; - int noOfPatientsRate; - String qR; - List speciality; + String? setupID; + int? projectID; + int? patientID; + int? appointmentNo; + String? appointmentDate; + String? doctorName; + String? clinicDescription; + String? name; + int? episodeID; + int? actualDoctorRate; + int? clinicID; + String? companyName; + String? despensedStatus; + String? dischargeDate; + int? dischargeNo; + int? doctorID; + String? doctorImageURL; + int? doctorRate; + String? doctorTitle; + int? gender; + String? genderDescription; + bool? isActiveDoctorProfile; + bool? isDoctorAllowVedioCall; + bool? isExecludeDoctor; + bool? isInOutPatient; + String? isInOutPatientDescription; + String? isInOutPatientDescriptionN; + bool? isInsurancePatient; + String? nationalityFlagURL; + int? noOfPatientsRate; + String? qR; + List? speciality; PrescriptionResModel( {this.setupID, diff --git a/lib/core/model/patient/prescription/request_prescription_report.dart b/lib/core/model/patient/prescription/request_prescription_report.dart index 99b9762a..078fd874 100644 --- a/lib/core/model/patient/prescription/request_prescription_report.dart +++ b/lib/core/model/patient/prescription/request_prescription_report.dart @@ -1,18 +1,18 @@ class RequestPrescriptionReport { - int projectID; - int appointmentNo; - int episodeID; - String setupID; - int patientTypeID; - int languageID; - String stamp; - String iPAdress; - double versionID; - int channel; - String tokenID; - String sessionID; - bool isLoginForDoctorApp; - bool patientOutSA; + int? projectID; + int? appointmentNo; + int? episodeID; + String? setupID; + int? patientTypeID; + int? languageID; + String? stamp; + String? iPAdress; + double? versionID; + int? channel; + String? tokenID; + String? sessionID; + bool? isLoginForDoctorApp; + bool? patientOutSA; RequestPrescriptionReport( {this.projectID, diff --git a/lib/core/model/patient/radiology/radiology_req_model.dart b/lib/core/model/patient/radiology/radiology_req_model.dart index 47154d8b..dea61d5b 100644 --- a/lib/core/model/patient/radiology/radiology_req_model.dart +++ b/lib/core/model/patient/radiology/radiology_req_model.dart @@ -1,23 +1,16 @@ -/* - *@author: Elham Rababah - *@Date:6/5/2020 - *@param: - *@return:RadiologyReqModel - *@desc: RadiologyReqModel class - */ class RadiologyReqModel { - int patientID; - int projectID; - int languageID; - String stamp; - String iPAdress; - double versionID; - int channel; - String tokenID; - String sessionID; - bool isLoginForDoctorApp; - bool patientOutSA; - int patientTypeID; + int? patientID; + int? projectID; + int? languageID; + String? stamp; + String? iPAdress; + double? versionID; + int? channel; + String? tokenID; + String? sessionID; + bool? isLoginForDoctorApp; + bool? patientOutSA; + int? patientTypeID; RadiologyReqModel( {this.patientID, diff --git a/lib/core/model/patient/radiology/radiology_res_model.dart b/lib/core/model/patient/radiology/radiology_res_model.dart index 6c6509a9..8b3a7123 100644 --- a/lib/core/model/patient/radiology/radiology_res_model.dart +++ b/lib/core/model/patient/radiology/radiology_res_model.dart @@ -1,26 +1,19 @@ -/* - *@author: Elham Rababah - *@Date:6/5/2020 - *@param: - *@return:RadiologyResModel - *@desc: RadiologyResModel class - */ class RadiologyResModel { - String setupID; - int projectID; - int patientID; - int invoiceLineItemNo; - int invoiceNo; - String reportData; - String imageURL; - int clinicId; - int doctorId; - String reportDate; - String clinicName; - String doctorImageURL; - String doctorName; - String projectName; - Null statusDescription; + String? setupID; + int? projectID; + int? patientID; + int? invoiceLineItemNo; + int? invoiceNo; + String? reportData; + String? imageURL; + int? clinicId; + int? doctorId; + String? reportDate; + String? clinicName; + String? doctorImageURL; + String? doctorName; + String? projectName; + dynamic statusDescription; RadiologyResModel( {this.setupID, diff --git a/lib/core/model/patient/vital_sign/patient-vital-sign-data.dart b/lib/core/model/patient/vital_sign/patient-vital-sign-data.dart index 7c0448b9..89c17946 100644 --- a/lib/core/model/patient/vital_sign/patient-vital-sign-data.dart +++ b/lib/core/model/patient/vital_sign/patient-vital-sign-data.dart @@ -1,35 +1,36 @@ class VitalSignData { - int appointmentNo; - int bloodPressureCuffLocation; - int bloodPressureCuffSize; - int bloodPressureHigher; - int bloodPressureLower; - int bloodPressurePatientPosition; - var bodyMassIndex; - int fio2; - int headCircumCm; - var heightCm; - int idealBodyWeightLbs; - bool isPainManagementDone; - bool isVitalsRequired; - int leanBodyWeightLbs; - String painCharacter; - String painDuration; - String painFrequency; - String painLocation; - int painScore; - int patientMRN; - int patientType; - int pulseBeatPerMinute; - int pulseRhythm; - int respirationBeatPerMinute; - int respirationPattern; - int sao2; - int status; - var temperatureCelcius; - int temperatureCelciusMethod; - var waistSizeInch; - var weightKg; + int? appointmentNo; + int? bloodPressureCuffLocation; + int? bloodPressureCuffSize; + int? bloodPressureHigher; + int? bloodPressureLower; + int? bloodPressurePatientPosition; + dynamic bodyMassIndex; + int? fio2; + int? headCircumCm; + dynamic heightCm; + int? idealBodyWeightLbs; + bool? isPainManagementDone; + bool? isVitalsRequired; + int? leanBodyWeightLbs; + String? painCharacter; + String? painDuration; + String? painFrequency; + String? painLocation; + int? painScore; + int? patientMRN; + int? patientType; + int? pulseBeatPerMinute; + int? pulseRhythm; + int? respirationBeatPerMinute; + int? respirationPattern; + int? sao2; + int? status; + dynamic temperatureCelcius; + int? temperatureCelciusMethod; + dynamic waistSizeInch; + dynamic weightKg; + VitalSignData( {this.appointmentNo, diff --git a/lib/core/model/patient/vital_sign/patient-vital-sign-history.dart b/lib/core/model/patient/vital_sign/patient-vital-sign-history.dart index ed39a86e..d3d445f6 100644 --- a/lib/core/model/patient/vital_sign/patient-vital-sign-history.dart +++ b/lib/core/model/patient/vital_sign/patient-vital-sign-history.dart @@ -25,9 +25,9 @@ class VitalSignHistory { var painDuration; var painCharacter; var painFrequency; - bool isPainManagementDone; + bool? isPainManagementDone; var status; - bool isVitalsRequired; + bool? isVitalsRequired; var patientID; var createdOn; var doctorID; diff --git a/lib/core/model/patient/vital_sign/vital_sign_req_model.dart b/lib/core/model/patient/vital_sign/vital_sign_req_model.dart index 4861bf8d..5286c090 100644 --- a/lib/core/model/patient/vital_sign/vital_sign_req_model.dart +++ b/lib/core/model/patient/vital_sign/vital_sign_req_model.dart @@ -1,26 +1,19 @@ -/* - *@author: Elham Rababah - *@Date:27/4/2020 - *@param: - *@return: - *@desc: VitalSignReqModel - */ class VitalSignReqModel { - int patientID; - int projectID; - int patientTypeID; - int inOutpatientType; - int transNo; - int languageID; - String stamp; + int? patientID; + int? projectID; + int? patientTypeID; + int? inOutpatientType; + int? transNo; + int? languageID; + String? stamp; - String iPAdress; - double versionID; - int channel; - String tokenID; - String sessionID; - bool isLoginForDoctorApp; - bool patientOutSA; + String? iPAdress; + double? versionID; + int? channel; + String? tokenID; + String? sessionID; + bool? isLoginForDoctorApp; + bool? patientOutSA; VitalSignReqModel( {this.patientID, diff --git a/lib/landing_page.dart b/lib/landing_page.dart index 03a3b909..39157266 100644 --- a/lib/landing_page.dart +++ b/lib/landing_page.dart @@ -1,5 +1,3 @@ -//@dart=2.9 - import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/screens/doctor/doctor_replay/doctor_reply_screen.dart'; import 'package:doctor_app_flutter/screens/doctor/my_schedule_screen.dart'; @@ -23,7 +21,7 @@ class LandingPage extends StatefulWidget { class _LandingPageState extends State { int currentTab = 0; - PageController pageController; + late PageController pageController; _changeCurrentTab(int tab) { setState(() { @@ -44,7 +42,7 @@ class _LandingPageState extends State { return AppScaffold( appBar: currentTab != 0 ? AppBar( - toolbarHeight: 95, + toolbarHeight: 95, elevation: 0, backgroundColor: HexColor('#FFFFFF'), //textTheme: TextTheme(headline6: TextStyle(color: Colors.white)), @@ -61,12 +59,9 @@ class _LandingPageState extends State { builder: (BuildContext context) { return Container( width: 40, - margin: EdgeInsets.only( - left: projectViewModel.isArabic ? 0 : 20, - right: projectViewModel.isArabic ? 20 : 0), + margin: EdgeInsets.only(left: projectViewModel.isArabic ? 0 : 20, right: projectViewModel.isArabic ? 20 : 0), child: IconButton( - icon: SvgPicture.asset('assets/images/svgs/menu.svg', - height: 25, width: 10), + icon: SvgPicture.asset('assets/images/svgs/menu.svg', height: 25, width: 10), iconSize: 15, color: Color(0xff2B353E), onPressed: () => Scaffold.of(context).openDrawer(), @@ -114,11 +109,11 @@ class _LandingPageState extends State { } } -class MyAppbar extends StatelessWidget with PreferredSizeWidget { +class MyAppbar extends StatelessWidget { @override final Size preferredSize; - MyAppbar({Key key}) + MyAppbar({Key? key}) : preferredSize = Size.fromHeight(0.0), super(key: key); diff --git a/lib/main.dart b/lib/main.dart index f9aee322..59ea002c 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -68,7 +68,7 @@ class MyApp extends StatelessWidget { theme: ThemeData( primarySwatch: Colors.grey, primaryColor: Colors.grey, - buttonColor: HexColor('#D02127'), + //buttonColor: HexColor('#D02127'), fontFamily: 'Poppins', dividerColor: Colors.grey[350], backgroundColor: Color.fromRGBO(255, 255, 255, 1), diff --git a/lib/update_page.dart b/lib/update_page.dart index 317f0185..8bd28a09 100644 --- a/lib/update_page.dart +++ b/lib/update_page.dart @@ -1,5 +1,3 @@ -// @dart=2.9 - import 'dart:io' show Platform; import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; @@ -10,14 +8,12 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:url_launcher/url_launcher.dart'; - class UpdatePage extends StatelessWidget { - final String message; - final String androidLink; - final String iosLink; + final String? message; + final String? androidLink; + final String? iosLink; - const UpdatePage({Key key, this.message, this.androidLink, this.iosLink}) - : super(key: key); + const UpdatePage({Key? key, this.message, this.androidLink, this.iosLink}) : super(key: key); @override Widget build(BuildContext context) { @@ -63,12 +59,12 @@ class UpdatePage extends StatelessWidget { // padding: const EdgeInsets.all(8.0), margin: EdgeInsets.all(15), child: AppButton( - color: Colors.red[800], + color: Colors.red[800]!, onPressed: () { if (Platform.isIOS) - launch(iosLink); + launchUrl(Uri.parse(iosLink!)); else - launch(androidLink); + launchUrl(Uri.parse(androidLink!)); }, title: TranslationBase.of(context).updateNow.toUpperCase(), ), diff --git a/pubspec.lock b/pubspec.lock deleted file mode 100644 index 424d9a09..00000000 --- a/pubspec.lock +++ /dev/null @@ -1,1424 +0,0 @@ -# Generated by pub -# See https://dart.dev/tools/pub/glossary#lockfile -packages: - _fe_analyzer_shared: - dependency: transitive - description: - name: _fe_analyzer_shared - url: "https://pub.dartlang.org" - source: hosted - version: "22.0.0" - analyzer: - dependency: transitive - description: - name: analyzer - url: "https://pub.dartlang.org" - source: hosted - version: "1.7.2" - archive: - dependency: transitive - description: - name: archive - url: "https://pub.dartlang.org" - source: hosted - version: "3.2.0" - args: - dependency: transitive - description: - name: args - url: "https://pub.dartlang.org" - source: hosted - version: "2.3.0" - async: - dependency: transitive - description: - name: async - url: "https://pub.dartlang.org" - source: hosted - version: "2.8.2" - autocomplete_textfield: - dependency: "direct main" - description: - name: autocomplete_textfield - url: "https://pub.dartlang.org" - source: hosted - version: "1.7.3" - badges: - dependency: "direct main" - description: - name: badges - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.2" - barcode_scan2: - dependency: "direct main" - description: - name: barcode_scan2 - url: "https://pub.dartlang.org" - source: hosted - version: "4.2.0" - bazel_worker: - dependency: transitive - description: - name: bazel_worker - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.1" - boolean_selector: - dependency: transitive - description: - name: boolean_selector - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.0" - build: - dependency: transitive - description: - name: build - url: "https://pub.dartlang.org" - source: hosted - version: "1.6.3" - build_config: - dependency: transitive - description: - name: build_config - url: "https://pub.dartlang.org" - source: hosted - version: "0.4.6" - build_daemon: - dependency: transitive - description: - name: build_daemon - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.10" - build_modules: - dependency: transitive - description: - name: build_modules - url: "https://pub.dartlang.org" - source: hosted - version: "3.0.5" - build_resolvers: - dependency: transitive - description: - name: build_resolvers - url: "https://pub.dartlang.org" - source: hosted - version: "1.5.4" - build_runner: - dependency: "direct dev" - description: - name: build_runner - url: "https://pub.dartlang.org" - source: hosted - version: "1.11.5" - build_runner_core: - dependency: transitive - description: - name: build_runner_core - url: "https://pub.dartlang.org" - source: hosted - version: "6.1.10" - build_web_compilers: - dependency: "direct dev" - description: - name: build_web_compilers - url: "https://pub.dartlang.org" - source: hosted - version: "2.16.5" - built_collection: - dependency: transitive - description: - name: built_collection - url: "https://pub.dartlang.org" - source: hosted - version: "5.1.1" - built_value: - dependency: transitive - description: - name: built_value - url: "https://pub.dartlang.org" - source: hosted - version: "8.1.4" - cached_network_image: - dependency: "direct main" - description: - name: cached_network_image - url: "https://pub.dartlang.org" - source: hosted - version: "3.2.0" - cached_network_image_platform_interface: - dependency: transitive - description: - name: cached_network_image_platform_interface - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.0" - cached_network_image_web: - dependency: transitive - description: - name: cached_network_image_web - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.1" - characters: - dependency: transitive - description: - name: characters - url: "https://pub.dartlang.org" - source: hosted - version: "1.2.0" - charcode: - dependency: transitive - description: - name: charcode - url: "https://pub.dartlang.org" - source: hosted - version: "1.3.1" - charts_common: - dependency: transitive - description: - name: charts_common - url: "https://pub.dartlang.org" - source: hosted - version: "0.12.0" - charts_flutter: - dependency: "direct main" - description: - name: charts_flutter - url: "https://pub.dartlang.org" - source: hosted - version: "0.12.0" - checked_yaml: - dependency: transitive - description: - name: checked_yaml - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.4" - chewie: - dependency: transitive - description: - name: chewie - url: "https://pub.dartlang.org" - source: hosted - version: "1.1.0" - chewie_audio: - dependency: transitive - description: - name: chewie_audio - url: "https://pub.dartlang.org" - source: hosted - version: "1.3.0" - cli_util: - dependency: transitive - description: - name: cli_util - url: "https://pub.dartlang.org" - source: hosted - version: "0.3.5" - clock: - dependency: transitive - description: - name: clock - url: "https://pub.dartlang.org" - source: hosted - version: "1.1.0" - code_builder: - dependency: transitive - description: - name: code_builder - url: "https://pub.dartlang.org" - source: hosted - version: "3.7.0" - collection: - dependency: transitive - description: - name: collection - url: "https://pub.dartlang.org" - source: hosted - version: "1.15.0" - connectivity: - dependency: "direct main" - description: - name: connectivity - url: "https://pub.dartlang.org" - source: hosted - version: "3.0.6" - connectivity_for_web: - dependency: transitive - description: - name: connectivity_for_web - url: "https://pub.dartlang.org" - source: hosted - version: "0.4.0+1" - connectivity_macos: - dependency: transitive - description: - name: connectivity_macos - url: "https://pub.dartlang.org" - source: hosted - version: "0.2.1+2" - connectivity_platform_interface: - dependency: transitive - description: - name: connectivity_platform_interface - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.1" - convert: - dependency: transitive - description: - name: convert - url: "https://pub.dartlang.org" - source: hosted - version: "3.0.1" - crypto: - dependency: transitive - description: - name: crypto - url: "https://pub.dartlang.org" - source: hosted - version: "3.0.1" - csslib: - dependency: transitive - description: - name: csslib - url: "https://pub.dartlang.org" - source: hosted - version: "0.17.1" - cupertino_icons: - dependency: "direct main" - description: - name: cupertino_icons - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.4" - dart_style: - dependency: transitive - description: - name: dart_style - url: "https://pub.dartlang.org" - source: hosted - version: "1.3.14" - date_time_picker: - dependency: "direct main" - description: - name: date_time_picker - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.0" - device_info: - dependency: "direct main" - description: - name: device_info - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.3" - device_info_platform_interface: - dependency: transitive - description: - name: device_info_platform_interface - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.1" - dropdown_search: - dependency: "direct main" - description: - name: dropdown_search - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.1" - equatable: - dependency: transitive - description: - name: equatable - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.3" - eva_icons_flutter: - dependency: "direct main" - description: - name: eva_icons_flutter - url: "https://pub.dartlang.org" - source: hosted - version: "3.0.2" - expandable: - dependency: "direct main" - description: - name: expandable - url: "https://pub.dartlang.org" - source: hosted - version: "5.0.1" - fake_async: - dependency: transitive - description: - name: fake_async - url: "https://pub.dartlang.org" - source: hosted - version: "1.2.0" - ffi: - dependency: transitive - description: - name: ffi - url: "https://pub.dartlang.org" - source: hosted - version: "1.1.2" - file: - dependency: transitive - description: - name: file - url: "https://pub.dartlang.org" - source: hosted - version: "6.1.2" - file_picker: - dependency: "direct main" - description: - name: file_picker - url: "https://pub.dartlang.org" - source: hosted - version: "3.0.4" - firebase: - dependency: transitive - description: - name: firebase - url: "https://pub.dartlang.org" - source: hosted - version: "9.0.2" - firebase_analytics: - dependency: "direct main" - description: - name: firebase_analytics - url: "https://pub.dartlang.org" - source: hosted - version: "8.3.4" - firebase_analytics_platform_interface: - dependency: transitive - description: - name: firebase_analytics_platform_interface - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.1" - firebase_analytics_web: - dependency: transitive - description: - name: firebase_analytics_web - url: "https://pub.dartlang.org" - source: hosted - version: "0.3.0+1" - firebase_core: - dependency: transitive - description: - name: firebase_core - url: "https://pub.dartlang.org" - source: hosted - version: "1.12.0" - firebase_core_platform_interface: - dependency: transitive - description: - name: firebase_core_platform_interface - url: "https://pub.dartlang.org" - source: hosted - version: "4.2.4" - firebase_core_web: - dependency: transitive - description: - name: firebase_core_web - url: "https://pub.dartlang.org" - source: hosted - version: "1.5.4" - firebase_messaging: - dependency: "direct main" - description: - name: firebase_messaging - url: "https://pub.dartlang.org" - source: hosted - version: "10.0.9" - firebase_messaging_platform_interface: - dependency: transitive - description: - name: firebase_messaging_platform_interface - url: "https://pub.dartlang.org" - source: hosted - version: "3.1.6" - firebase_messaging_web: - dependency: transitive - description: - name: firebase_messaging_web - url: "https://pub.dartlang.org" - source: hosted - version: "2.2.7" - fixnum: - dependency: transitive - description: - name: fixnum - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.0" - fl_chart: - dependency: "direct main" - description: - name: fl_chart - url: "https://pub.dartlang.org" - source: hosted - version: "0.36.4" - flutter: - dependency: "direct main" - description: flutter - source: sdk - version: "0.0.0" - flutter_blurhash: - dependency: transitive - description: - name: flutter_blurhash - url: "https://pub.dartlang.org" - source: hosted - version: "0.6.0" - flutter_cache_manager: - dependency: transitive - description: - name: flutter_cache_manager - url: "https://pub.dartlang.org" - source: hosted - version: "3.3.0" - flutter_colorpicker: - dependency: "direct main" - description: - name: flutter_colorpicker - url: "https://pub.dartlang.org" - source: hosted - version: "0.5.0" - flutter_datetime_picker: - dependency: "direct main" - description: - name: flutter_datetime_picker - url: "https://pub.dartlang.org" - source: hosted - version: "1.5.1" - flutter_device_type: - dependency: "direct main" - description: - name: flutter_device_type - url: "https://pub.dartlang.org" - source: hosted - version: "0.4.0" - flutter_gifimage: - dependency: "direct main" - description: - name: flutter_gifimage - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.1" - flutter_html: - dependency: "direct main" - description: - name: flutter_html - url: "https://pub.dartlang.org" - source: hosted - version: "2.2.1" - flutter_inappwebview: - dependency: transitive - description: - name: flutter_inappwebview - url: "https://pub.dartlang.org" - source: hosted - version: "5.3.2" - flutter_keyboard_visibility: - dependency: transitive - description: - name: flutter_keyboard_visibility - url: "https://pub.dartlang.org" - source: hosted - version: "5.1.1" - flutter_keyboard_visibility_platform_interface: - dependency: transitive - description: - name: flutter_keyboard_visibility_platform_interface - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.0" - flutter_keyboard_visibility_web: - dependency: transitive - description: - name: flutter_keyboard_visibility_web - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.0" - flutter_layout_grid: - dependency: transitive - description: - name: flutter_layout_grid - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.3" - flutter_localizations: - dependency: "direct main" - description: flutter - source: sdk - version: "0.0.0" - flutter_math_fork: - dependency: transitive - description: - name: flutter_math_fork - url: "https://pub.dartlang.org" - source: hosted - version: "0.5.0" - flutter_page_indicator: - dependency: transitive - description: - name: flutter_page_indicator - url: "https://pub.dartlang.org" - source: hosted - version: "0.0.3" - flutter_plugin_android_lifecycle: - dependency: transitive - description: - name: flutter_plugin_android_lifecycle - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.5" - flutter_staggered_grid_view: - dependency: "direct main" - description: - name: flutter_staggered_grid_view - url: "https://pub.dartlang.org" - source: hosted - version: "0.4.1" - flutter_svg: - dependency: transitive - description: - name: flutter_svg - url: "https://pub.dartlang.org" - source: hosted - version: "0.23.0+1" - flutter_swiper: - dependency: "direct main" - description: - name: flutter_swiper - url: "https://pub.dartlang.org" - source: hosted - version: "1.1.6" - flutter_test: - dependency: "direct dev" - description: flutter - source: sdk - version: "0.0.0" - flutter_web_plugins: - dependency: transitive - description: flutter - source: sdk - version: "0.0.0" - fluttertoast: - dependency: "direct main" - description: - name: fluttertoast - url: "https://pub.dartlang.org" - source: hosted - version: "8.0.8" - font_awesome_flutter: - dependency: "direct main" - description: - name: font_awesome_flutter - url: "https://pub.dartlang.org" - source: hosted - version: "9.2.0" - get_it: - dependency: "direct main" - description: - name: get_it - url: "https://pub.dartlang.org" - source: hosted - version: "7.2.0" - glob: - dependency: transitive - description: - name: glob - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.2" - graphs: - dependency: transitive - description: - name: graphs - url: "https://pub.dartlang.org" - source: hosted - version: "0.2.0" - hexcolor: - dependency: "direct main" - description: - name: hexcolor - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.6" - hijri: - dependency: transitive - description: - name: hijri - url: "https://pub.dartlang.org" - source: hosted - version: "3.0.0" - hijri_picker: - dependency: "direct main" - description: - name: hijri_picker - url: "https://pub.dartlang.org" - source: hosted - version: "3.0.0" - html: - dependency: "direct main" - description: - name: html - url: "https://pub.dartlang.org" - source: hosted - version: "0.15.0" - html_editor_enhanced: - dependency: "direct main" - description: - name: html_editor_enhanced - url: "https://pub.dartlang.org" - source: hosted - version: "2.2.0+1-dev.1" - http: - dependency: "direct main" - description: - name: http - url: "https://pub.dartlang.org" - source: hosted - version: "0.13.4" - http_interceptor: - dependency: "direct main" - description: - name: http_interceptor - url: "https://pub.dartlang.org" - source: hosted - version: "0.4.1" - http_multi_server: - dependency: transitive - description: - name: http_multi_server - url: "https://pub.dartlang.org" - source: hosted - version: "2.2.0" - http_parser: - dependency: transitive - description: - name: http_parser - url: "https://pub.dartlang.org" - source: hosted - version: "4.0.0" - infinite_listview: - dependency: transitive - description: - name: infinite_listview - url: "https://pub.dartlang.org" - source: hosted - version: "1.1.0" - intl: - dependency: "direct main" - description: - name: intl - url: "https://pub.dartlang.org" - source: hosted - version: "0.17.0" - io: - dependency: transitive - description: - name: io - url: "https://pub.dartlang.org" - source: hosted - version: "0.3.5" - js: - dependency: transitive - description: - name: js - url: "https://pub.dartlang.org" - source: hosted - version: "0.6.3" - json_annotation: - dependency: transitive - description: - name: json_annotation - url: "https://pub.dartlang.org" - source: hosted - version: "3.1.1" - local_auth: - dependency: "direct main" - description: - name: local_auth - url: "https://pub.dartlang.org" - source: hosted - version: "1.1.10" - logging: - dependency: transitive - description: - name: logging - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.2" - maps_launcher: - dependency: "direct main" - description: - name: maps_launcher - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.1" - matcher: - dependency: transitive - description: - name: matcher - url: "https://pub.dartlang.org" - source: hosted - version: "0.12.11" - meta: - dependency: transitive - description: - name: meta - url: "https://pub.dartlang.org" - source: hosted - version: "1.7.0" - mime: - dependency: transitive - description: - name: mime - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.1" - nested: - dependency: transitive - description: - name: nested - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.0" - numberpicker: - dependency: transitive - description: - name: numberpicker - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.1" - numerus: - dependency: transitive - description: - name: numerus - url: "https://pub.dartlang.org" - source: hosted - version: "1.1.1" - octo_image: - dependency: transitive - description: - name: octo_image - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.1" - package_config: - dependency: transitive - description: - name: package_config - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.2" - path: - dependency: transitive - description: - name: path - url: "https://pub.dartlang.org" - source: hosted - version: "1.8.0" - path_drawing: - dependency: transitive - description: - name: path_drawing - url: "https://pub.dartlang.org" - source: hosted - version: "0.5.1+1" - path_parsing: - dependency: transitive - description: - name: path_parsing - url: "https://pub.dartlang.org" - source: hosted - version: "0.2.1" - path_provider: - dependency: transitive - description: - name: path_provider - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.9" - path_provider_android: - dependency: transitive - description: - name: path_provider_android - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.11" - path_provider_ios: - dependency: transitive - description: - name: path_provider_ios - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.7" - path_provider_linux: - dependency: transitive - description: - name: path_provider_linux - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.5" - path_provider_macos: - dependency: transitive - description: - name: path_provider_macos - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.5" - path_provider_platform_interface: - dependency: transitive - description: - name: path_provider_platform_interface - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.3" - path_provider_windows: - dependency: transitive - description: - name: path_provider_windows - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.5" - pedantic: - dependency: transitive - description: - name: pedantic - url: "https://pub.dartlang.org" - source: hosted - version: "1.11.1" - percent_indicator: - dependency: "direct main" - description: - name: percent_indicator - url: "https://pub.dartlang.org" - source: hosted - version: "3.4.0" - permission_handler: - dependency: "direct main" - description: - name: permission_handler - url: "https://pub.dartlang.org" - source: hosted - version: "8.3.0" - permission_handler_platform_interface: - dependency: transitive - description: - name: permission_handler_platform_interface - url: "https://pub.dartlang.org" - source: hosted - version: "3.7.0" - petitparser: - dependency: transitive - description: - name: petitparser - url: "https://pub.dartlang.org" - source: hosted - version: "4.4.0" - platform: - dependency: transitive - description: - name: platform - url: "https://pub.dartlang.org" - source: hosted - version: "3.1.0" - plugin_platform_interface: - dependency: transitive - description: - name: plugin_platform_interface - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.2" - pointer_interceptor: - dependency: transitive - description: - name: pointer_interceptor - url: "https://pub.dartlang.org" - source: hosted - version: "0.9.1" - pool: - dependency: transitive - description: - name: pool - url: "https://pub.dartlang.org" - source: hosted - version: "1.5.0" - process: - dependency: transitive - description: - name: process - url: "https://pub.dartlang.org" - source: hosted - version: "4.2.4" - protobuf: - dependency: transitive - description: - name: protobuf - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.1" - provider: - dependency: "direct main" - description: - name: provider - url: "https://pub.dartlang.org" - source: hosted - version: "6.0.2" - pub_semver: - dependency: transitive - description: - name: pub_semver - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.0" - pubspec_parse: - dependency: transitive - description: - name: pubspec_parse - url: "https://pub.dartlang.org" - source: hosted - version: "0.1.8" - quiver: - dependency: "direct main" - description: - name: quiver - url: "https://pub.dartlang.org" - source: hosted - version: "3.0.1+1" - rxdart: - dependency: transitive - description: - name: rxdart - url: "https://pub.dartlang.org" - source: hosted - version: "0.27.3" - scratch_space: - dependency: transitive - description: - name: scratch_space - url: "https://pub.dartlang.org" - source: hosted - version: "0.0.4+3" - shared_preferences: - dependency: "direct main" - description: - name: shared_preferences - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.13" - shared_preferences_android: - dependency: transitive - description: - name: shared_preferences_android - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.11" - shared_preferences_ios: - dependency: transitive - description: - name: shared_preferences_ios - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.10" - shared_preferences_linux: - dependency: transitive - description: - name: shared_preferences_linux - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.0" - shared_preferences_macos: - dependency: transitive - description: - name: shared_preferences_macos - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.3" - shared_preferences_platform_interface: - dependency: transitive - description: - name: shared_preferences_platform_interface - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.0" - shared_preferences_web: - dependency: transitive - description: - name: shared_preferences_web - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.3" - shared_preferences_windows: - dependency: transitive - description: - name: shared_preferences_windows - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.0" - shelf: - dependency: transitive - description: - name: shelf - url: "https://pub.dartlang.org" - source: hosted - version: "1.2.0" - shelf_web_socket: - dependency: transitive - description: - name: shelf_web_socket - url: "https://pub.dartlang.org" - source: hosted - version: "0.2.4+1" - sky_engine: - dependency: transitive - description: flutter - source: sdk - version: "0.0.99" - source_maps: - dependency: transitive - description: - name: source_maps - url: "https://pub.dartlang.org" - source: hosted - version: "0.10.10" - source_span: - dependency: transitive - description: - name: source_span - url: "https://pub.dartlang.org" - source: hosted - version: "1.8.1" - speech_to_text: - dependency: "direct main" - description: - path: speech_to_text - relative: true - source: path - version: "0.0.0" - sqflite: - dependency: transitive - description: - name: sqflite - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.2" - sqflite_common: - dependency: transitive - description: - name: sqflite_common - url: "https://pub.dartlang.org" - source: hosted - version: "2.2.0" - stack_trace: - dependency: transitive - description: - name: stack_trace - url: "https://pub.dartlang.org" - source: hosted - version: "1.10.0" - sticky_headers: - dependency: "direct main" - description: - name: sticky_headers - url: "https://pub.dartlang.org" - source: hosted - version: "0.2.0" - stream_channel: - dependency: transitive - description: - name: stream_channel - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.0" - stream_transform: - dependency: transitive - description: - name: stream_transform - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.0" - string_scanner: - dependency: transitive - description: - name: string_scanner - url: "https://pub.dartlang.org" - source: hosted - version: "1.1.0" - synchronized: - dependency: transitive - description: - name: synchronized - url: "https://pub.dartlang.org" - source: hosted - version: "3.0.0" - term_glyph: - dependency: transitive - description: - name: term_glyph - url: "https://pub.dartlang.org" - source: hosted - version: "1.2.0" - test_api: - dependency: transitive - description: - name: test_api - url: "https://pub.dartlang.org" - source: hosted - version: "0.4.3" - timing: - dependency: transitive - description: - name: timing - url: "https://pub.dartlang.org" - source: hosted - version: "0.1.1+3" - transformer_page_view: - dependency: transitive - description: - name: transformer_page_view - url: "https://pub.dartlang.org" - source: hosted - version: "0.1.6" - tuple: - dependency: transitive - description: - name: tuple - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.0" - typed_data: - dependency: transitive - description: - name: typed_data - url: "https://pub.dartlang.org" - source: hosted - version: "1.3.0" - url_launcher: - dependency: "direct main" - description: - name: url_launcher - url: "https://pub.dartlang.org" - source: hosted - version: "6.0.20" - url_launcher_android: - dependency: transitive - description: - name: url_launcher_android - url: "https://pub.dartlang.org" - source: hosted - version: "6.0.15" - url_launcher_ios: - dependency: transitive - description: - name: url_launcher_ios - url: "https://pub.dartlang.org" - source: hosted - version: "6.0.15" - url_launcher_linux: - dependency: transitive - description: - name: url_launcher_linux - url: "https://pub.dartlang.org" - source: hosted - version: "3.0.0" - url_launcher_macos: - dependency: transitive - description: - name: url_launcher_macos - url: "https://pub.dartlang.org" - source: hosted - version: "3.0.0" - url_launcher_platform_interface: - dependency: transitive - description: - name: url_launcher_platform_interface - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.5" - url_launcher_web: - dependency: transitive - description: - name: url_launcher_web - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.6" - url_launcher_windows: - dependency: transitive - description: - name: url_launcher_windows - url: "https://pub.dartlang.org" - source: hosted - version: "3.0.0" - uuid: - dependency: transitive - description: - name: uuid - url: "https://pub.dartlang.org" - source: hosted - version: "3.0.5" - vector_math: - dependency: transitive - description: - name: vector_math - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.1" - video_player: - dependency: transitive - description: - name: video_player - url: "https://pub.dartlang.org" - source: hosted - version: "2.2.18" - video_player_android: - dependency: transitive - description: - name: video_player_android - url: "https://pub.dartlang.org" - source: hosted - version: "2.2.17" - video_player_avfoundation: - dependency: transitive - description: - name: video_player_avfoundation - url: "https://pub.dartlang.org" - source: hosted - version: "2.2.18" - video_player_platform_interface: - dependency: transitive - description: - name: video_player_platform_interface - url: "https://pub.dartlang.org" - source: hosted - version: "5.0.2" - video_player_web: - dependency: transitive - description: - name: video_player_web - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.7" - visibility_detector: - dependency: transitive - description: - name: visibility_detector - url: "https://pub.dartlang.org" - source: hosted - version: "0.2.2" - wakelock: - dependency: transitive - description: - name: wakelock - url: "https://pub.dartlang.org" - source: hosted - version: "0.5.6" - wakelock_macos: - dependency: transitive - description: - name: wakelock_macos - url: "https://pub.dartlang.org" - source: hosted - version: "0.4.0" - wakelock_platform_interface: - dependency: transitive - description: - name: wakelock_platform_interface - url: "https://pub.dartlang.org" - source: hosted - version: "0.3.0" - wakelock_web: - dependency: transitive - description: - name: wakelock_web - url: "https://pub.dartlang.org" - source: hosted - version: "0.4.0" - wakelock_windows: - dependency: transitive - description: - name: wakelock_windows - url: "https://pub.dartlang.org" - source: hosted - version: "0.2.0" - watcher: - dependency: transitive - description: - name: watcher - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.1" - web_socket_channel: - dependency: transitive - description: - name: web_socket_channel - url: "https://pub.dartlang.org" - source: hosted - version: "1.2.0" - webview_flutter: - dependency: transitive - description: - name: webview_flutter - url: "https://pub.dartlang.org" - source: hosted - version: "2.8.0" - webview_flutter_android: - dependency: transitive - description: - name: webview_flutter_android - url: "https://pub.dartlang.org" - source: hosted - version: "2.8.2" - webview_flutter_platform_interface: - dependency: transitive - description: - name: webview_flutter_platform_interface - url: "https://pub.dartlang.org" - source: hosted - version: "1.8.1" - webview_flutter_wkwebview: - dependency: transitive - description: - name: webview_flutter_wkwebview - url: "https://pub.dartlang.org" - source: hosted - version: "2.7.1" - win32: - dependency: transitive - description: - name: win32 - url: "https://pub.dartlang.org" - source: hosted - version: "2.3.11" - xdg_directories: - dependency: transitive - description: - name: xdg_directories - url: "https://pub.dartlang.org" - source: hosted - version: "0.2.0+1" - xml: - dependency: transitive - description: - name: xml - url: "https://pub.dartlang.org" - source: hosted - version: "5.3.1" - yaml: - dependency: transitive - description: - name: yaml - url: "https://pub.dartlang.org" - source: hosted - version: "3.1.0" -sdks: - dart: ">=2.15.0 <3.0.0" - flutter: ">=2.8.0" diff --git a/pubspec.yaml b/pubspec.yaml index dfc76868..2b347826 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -15,7 +15,7 @@ version: 4.3.5+1 environment: - sdk: ">=2.7.0 <3.0.0" + sdk: ">=3.0.0 <3.13.0" #dependency_overrides: @@ -27,87 +27,91 @@ environment: dependencies: flutter: sdk: flutter - hexcolor: ^2.0.4 + hexcolor: ^3.0.1 flutter_localizations: sdk: flutter + intl: ^0.18.1 flutter_device_type: ^0.4.0 - intl: ^0.17.0 - http: ^0.13.0 - provider: ^6.0.1 - shared_preferences: ^2.0.6 + http: ^1.1.2 + provider: ^6.1.1 + shared_preferences: ^2.2.2 # imei_plugin: ^1.2.0 # flutter_flexible_toast: ^0.1.4 - fluttertoast: ^8.0.8 - local_auth: ^1.1.6 - http_interceptor: ^0.4.1 + fluttertoast: ^8.2.4 + local_auth: ^2.1.7 + http_interceptor: any connectivity: ^3.0.6 - maps_launcher: ^2.0.0 - url_launcher: ^6.0.6 - charts_flutter: ^0.12.0 - flutter_swiper: ^1.1.6 + maps_launcher: ^2.2.0 + url_launcher: ^6.2.1 +# charts_flutter: ^0.12.0 + flutter_charts: ^0.5.2 + #flutter_swiper: ^1.1.6 #Icons - eva_icons_flutter: ^3.0.0 - font_awesome_flutter: ^9.0.0 - dropdown_search: ^2.0.1 - flutter_staggered_grid_view: ^0.4.0 + eva_icons_flutter: ^3.1.0 + font_awesome_flutter: ^10.6.0 + dropdown_search: ^5.0.6 + flutter_staggered_grid_view: ^0.7.0 expandable: ^5.0.1 # Qr code Scanner - barcode_scan2: ^4.1.4 + barcode_scan2: ^4.3.0 # permissions - permission_handler: ^8.0.1 + permission_handler: ^11.1.0 device_info: ^2.0.2 # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. - cupertino_icons: ^1.0.3 + cupertino_icons: ^1.0.6 # SVG #flutter_svg: ^1.0.0 - percent_indicator: ^3.0.1 + percent_indicator: ^4.2.3 #Dependency Injection - get_it: ^7.1.3 + get_it: ^7.6.4 #chart - fl_chart: ^0.36.1 + fl_chart: ^0.65.0 # Firebase - firebase_messaging: ^10.0.1 - firebase_analytics : ^8.3.4 + firebase_messaging: ^14.7.5 + firebase_analytics : ^10.7.1 #GIF image - flutter_gifimage: ^1.0.1 - +# flutter_gifimage: ^1.0.1 + flutter_gif: ^0.0.4 #Autocomplete TextField - autocomplete_textfield: ^1.7.3 - date_time_picker: ^2.0.0 + autocomplete_textfield: ^2.0.1 + #date_time_picker: ^2.0.0 + flutter_datetime_picker_plus: ^2.1.0 # Html - html: ^0.15.0 + html: ^0.15.4 # Flutter Html View flutter_html: ^2.1.0 - sticky_headers: ^0.2.0 - file_picker: ^3.0.2+2 + sticky_headers: ^0.3.0+2 + file_picker: ^6.1.1 #speech to text - speech_to_text: - path: speech_to_text +# speech_to_text: +# path: speech_to_text + + speech_to_text: ^6.4.1 - quiver: ^3.0.0 - flutter_colorpicker: ^0.5.0 + quiver: ^3.2.1 + flutter_colorpicker: ^1.0.3 # Html Editor Enhanced - html_editor_enhanced: ^2.1.1 + html_editor_enhanced: any #Network Image - cached_network_image: ^3.1.0+1 + cached_network_image: ^3.3.0 # Badges - badges: ^2.0.1 + badges: ^3.1.2 # Hijri # hijri: ^2.0.3 diff --git a/speech_to_text/.github/workflows/master.yml b/speech_to_text/.github/workflows/master.yml deleted file mode 100644 index 4d4cff1c..00000000 --- a/speech_to_text/.github/workflows/master.yml +++ /dev/null @@ -1,19 +0,0 @@ -name: build - -on: - push: - branches: - - master - -jobs: - test: - name: Test on Ubuntu - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v1 - - uses: subosito/flutter-action@v1.3.2 - with: - flutter-version: '1.17.1' - channel: 'stable' - - run: flutter pub get - - run: flutter test diff --git a/speech_to_text/.gitignore b/speech_to_text/.gitignore deleted file mode 100644 index 8969cbcd..00000000 --- a/speech_to_text/.gitignore +++ /dev/null @@ -1,11 +0,0 @@ -.DS_Store -.dart_tool/ - -.packages -.pub/ - -build/ -coverage/ -example/.flutter-plugins-dependencies -**/ios/Flutter/flutter_export_environment.sh -android/.idea/ diff --git a/speech_to_text/.metadata b/speech_to_text/.metadata deleted file mode 100644 index 1940d996..00000000 --- a/speech_to_text/.metadata +++ /dev/null @@ -1,10 +0,0 @@ -# This file tracks properties of this Flutter project. -# Used by Flutter tool to assess capabilities and perform upgrades etc. -# -# This file should be version controlled and should not be manually edited. - -version: - revision: 2d2a1ffec95cc70a3218872a2cd3f8de4933c42f - channel: stable - -project_type: plugin diff --git a/speech_to_text/CHANGELOG.md b/speech_to_text/CHANGELOG.md deleted file mode 100644 index 477e110c..00000000 --- a/speech_to_text/CHANGELOG.md +++ /dev/null @@ -1,166 +0,0 @@ -# Changelog - -## 2.3.0 - -### New - * new parameter `onDevice` on the `listen` method enforces on device recognition for sensitive content - * onSoundLevelChange now supported on iOS - * added compile troubleshooting help to README.md - * `SpeechToTextProvider` is an alternate and simpler way to interact with the `SpeechToText` plugin. - * new `provider_example.dart` example for usage of `SpeechToTextProvider`. -### Fix - * on iOS handles some conflicts with other applications better to keep speech working after calls for example - - -## 2.2.0 - -### New - * improved error handling and logging in the iOS implementation - * added general guides for iOS to the README - * moved stress testing out of the main example - * iOS now defaults to using the speaker rather than the receiver for start /stop sounds when no headphones -### Fix - * iOS now properly deactivates the audio session when no longer listening - * start and stop sounds on iOS should be more reliable when available - -## 2.1.0 -### Breaking - * `listenFor` now calls `stop` rather than `cancel` as this seems like more useful behaviour - -### Fix - * Android no longer stops or cancels the speech recognizer if it has already been shutdown by a - timeout or other platform behaviour. - * Android no longer tries to restart the listener when it is already active - * Now properly notifies errors that happen after listening stops due to platform callback rather than - client request. See https://github.com/csdcorp/speech_to_text/issues/51 - -## 2.0.1 -### Fix - * Resolves an issue with the Android implementation not handling permission requests properly on apps - that didn't use the 1.12.x plugin APIs for registration. The permission dialog would not appear and - permission was denied. - - -## 2.0.0 - -### Breaking - - * Upgraded to New Swift 1.12 plugin structure, may work with older Flutter version but not guaranteed - -### New - - * the plugin now requests both speech and microphone permission on initialize on iOS - * added `debugLogging` parameter to the `initialize` method to control native logging - -### Fix - - * The Android implementation now blocks duplicate results notifications. It appears that at least on some - Android versions the final results notification onResults is notified twice when Android automatically - terminates the session due to a pause time. The de-duplication looks for successive notifications - with < 100 ms between them and blocks the second. If you miss any onResult notifications please post - an issue. - -## 1.1.0 - -### New - - * error_timeout has been separated into error_network_timeout and error_speech_timeout - -## 1.0.0 - -### New - * hasPermission to check for the current permission without bringing up the system dialog - * `listen` has a new optional `cancelOnError` parameter to support automatically canceling - a listening session on a permanent error. - * `listen` has a new optional `partialResults` parameter that controls whether the callback - receives partial or only final results. - -## 0.8.0 - -### New - - * speech recognizer now exposes multiple possible transcriptions for each recognized speech - * alternates list on SpeechRecognitionResult exposes alternate transcriptions of voice - * confidence on SpeechRecognitionResult gives an estimate of confidence in the transcription - * isConfident on SpeechRecognitionResult supports testing confidence - * hasConfidenceRating on SpeechRecognitionResult indicates if confidence was provided from the device - * new SpeechRecognitionWords class gives details on per transcription words and confidence - -### Fix - - * speechRecognizer availabilityDidChange was crashing if invoked due to an invalid parameter type - * Added iOS platform 10 to example Podfile to resolve compilation warnings - -## 0.7.2 - -### Breaking - - * Upgrade Swift to version 5 to match Flutter. Projects using this plugin must now switch to 5. - -## 0.7.1 - -### Fix - - * Upgrade Kotlin to 1.3.5 to match the Flutter 1.12 version - * Upgrade Gradle build to 3.5.0 to match the Flutter 1.12 version - * Android version of the plugin was repeating the system default locale in the `locales` list - -## 0.7.0 - -### New - - * locales method returns the list of available languages for speech - * new optional localeId parameter on listen method supports choosing the comprehension language separately from the current system locale. - -### Breaking - - * `cancel` and `stop` are now async - -## 0.6.3 - -### Fix - - * request permission fix on Android to ensure it doesn't conflict with other requests - -## 0.6.2 - -### Fix - - * channel invoke wasn't being done on the main thread in iOS - -## 0.6.1 - -### Fix - - * listening sound was failing due to timing, now uses play and record mode on iOS. - - ## 0.6.0 -### Breaking - - * The filenames for the optional sounds for iOS have changed. - -### New - - * Added an optional listenFor parameter to set a max duration to listen for speech and then automatically cancel. - -### Fix - - * Was failing to play sounds because of record mode. Now plays sounds before going into record mode and after coming out. - * Status listener was being ignored, now properly notifies on status changes. - -## 0.5.1 - * Fixes a problem where the recognizer left the AVAudioSession in record mode which meant that subsequent sounds couldn't be played. - -## 0.5.0 -Initial draft with limited functionality, supports: - * initializing speech recognition - * asking the user for permission if required - * listening for recognized speech - * canceling the current recognition session - * stopping the current recognition session -* Android and iOS 10+ support - -Missing: - * some error handling - * testing across multiple OS versions - * and more, to be discovered... diff --git a/speech_to_text/LICENSE b/speech_to_text/LICENSE deleted file mode 100644 index 7c3991c8..00000000 --- a/speech_to_text/LICENSE +++ /dev/null @@ -1,29 +0,0 @@ -BSD 3-Clause License - -Copyright (c) 2019, Corner Software Development Corp. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -3. Neither the name of the copyright holder nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/speech_to_text/README.md b/speech_to_text/README.md deleted file mode 100644 index af726f0e..00000000 --- a/speech_to_text/README.md +++ /dev/null @@ -1,150 +0,0 @@ -# speech_to_text - -[![pub package](https://img.shields.io/badge/pub-v2.3.0-blue)](https://pub.dartlang.org/packages/speech_to_text) [![build status](https://github.com/csdcorp/speech_to_text/workflows/build/badge.svg)](https://github.com/csdcorp/speech_to_text/actions?query=workflow%3Abuild) - -A library that exposes device specific speech recognition capability. - -This plugin contains a set of classes that make it easy to use the speech recognition -capabilities of the mobile device in Flutter. It supports both Android and iOS. The -target use cases for this library are commands and short phrases, not continuous spoken -conversion or always on listening. - -## Recent Updates - -The 2.3.0 version adds `SpeechToTextProvider` as a simpler way to interact with the plugin. Checkout -the new `provider_example.dart` for intended usage. - -The 2.2.0 version improves audio session handling and start / stop sound playback on iOS. - -*Note*: Feedback from any test devices is welcome. - -## Using - -To recognize text from the microphone import the package and call the plugin, like so: - -```dart -import 'package:speech_to_text/speech_to_text.dart' as stt; - - stt.SpeechToText speech = stt.SpeechToText(); - bool available = await speech.initialize( onStatus: statusListener, onError: errorListener ); - if ( available ) { - speech.listen( onResult: resultListener ); - } - else { - print("The user has denied the use of speech recognition."); - } - // some time later... - speech.stop() -``` - -### Initialize once -The `initialize` method only needs to be called once per application session. After that `listen`, -`start`, `stop`, and `cancel` can be used to interact with the plugin. Subsequent calls to `initialize` -are ignored which is safe but does mean that the `onStatus` and `onError` callbacks cannot be reset after -the first call to `initialize`. For that reason there should be only one instance of the plugin per -application. The `SpeechToTextProvider` is one way to create a single instance and easily reuse it in -multiple widgets. - -## Permissions - -Applications using this plugin require user permissions. -### iOS - -Add the following keys to your _Info.plist_ file, located in `/ios/Runner/Info.plist`: - -* `NSSpeechRecognitionUsageDescription` - describe why your app uses speech recognition. This is called _Privacy - Speech Recognition Usage Description_ in the visual editor. -* `NSMicrophoneUsageDescription` - describe why your app needs access to the microphone. This is called _Privacy - Microphone Usage Description_ in the visual editor. - -### Android - -Add the record audio permission to your _AndroidManifest.xml_ file, located in `/android/app/src/main/AndroidManifest.xml`. - -* `android.permission.RECORD_AUDIO` - this permission is required for microphone access. -* `android.permission.INTERNET` - this permission is required because speech recognition may use remote services. - -## Adding Sounds for iOS (optional) - -Android automatically plays system sounds when speech listening starts or stops but iOS does not. This plugin supports playing sounds to indicate listening status on iOS if sound files are available as assets in the application. To enable sounds in an application using this plugin add the sound files to the project and reference them in the assets section of the application `pubspec.yaml`. The location and filenames of the sound files must exactly match what -is shown below or they will not be found. The example application for the plugin shows the usage. *Note* These files should be very short as they delay -the start / end of the speech recognizer until the sound playback is complete. -```yaml - assets: - - assets/sounds/speech_to_text_listening.m4r - - assets/sounds/speech_to_text_cancel.m4r - - assets/sounds/speech_to_text_stop.m4r -``` -* `speech_to_text_listening.m4r` - played when the listen method is called. -* `speech_to_text_cancel.m4r` - played when the cancel method is called. -* `speech_to_text_stop.m4r` - played when the stop method is called. - -## Troubleshooting - -### SDK version error trying to compile for Android -``` -Manifest merger failed : uses-sdk:minSdkVersion 16 cannot be smaller than version 21 declared in library [:speech_to_text] -``` -The speech_to_text plugin requires at least Android SDK 21 because some of the speech functions in Android -were only introduced in that version. To fix this error you need to change the `build.gradle` entry to reflect -this version. Here's what the relevant part of that file looked like as of this writing: -``` - defaultConfig { - applicationId "com.example.app" - minSdkVersion 21 - targetSdkVersion 28 - versionCode flutterVersionCode.toInteger() - versionName flutterVersionName - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - } -``` - -### Incorrect Swift version trying to compile for iOS -``` -/Users/markvandergon/flutter/.pub-cache/hosted/pub.dartlang.org/speech_to_text-1.1.0/ios/Classes/SwiftSpeechToTextPlugin.swift:224:44: error: value of type 'SwiftSpeechToTextPlugin' has no member 'AVAudioSession' - rememberedAudioCategory = self.AVAudioSession.Category - ~~~~ ^~~~~~~~~~~~~~ - /Users/markvandergon/flutter/.pub-cache/hosted/pub.dartlang.org/speech_to_text-1.1.0/ios/Classes/SwiftSpeechToTextPlugin.swift:227:63: error: type 'Int' has no member 'notifyOthersOnDeactivation' - try self.audioSession.setActive(true, withFlags: .notifyOthersOnDeactivation) -``` -This happens when the Swift language version is not set correctly. See this thread for help https://github.com/csdcorp/speech_to_text/issues/45. - -### Swift not supported trying to compile for iOS -``` -`speech_to_text` does not specify a Swift version and none of the targets (`Runner`) integrating it have the `SWIFT_VERSION` attribute set. -``` -This usually happens for older projects that only support Objective-C. See this thread for help https://github.com/csdcorp/speech_to_text/issues/88. - -### Not working on a particular Android device -The symptom for this issue is that the `initialize` method will always fail. If you turn on debug logging -using the `debugLogging: true` flag on the `initialize` method you'll see `'Speech recognition unavailable'` -in the Android log. There's a lengthy issue discussion here https://github.com/csdcorp/speech_to_text/issues/36 -about this. The issue seems to be that the recognizer is not always automatically enabled on the device. Two -key things helped resolve the issue in this case at least. - -#### First -1. Go to Google Play -2. Search for 'Google' -3. You should find this app: https://play.google.com/store/apps/details?id=com.google.android.googlequicksearchbox -If 'Disabled' enable it - -This is the SO post that helped: https://stackoverflow.com/questions/28769320/how-to-check-wether-speech-recognition-is-available-or-not - -#### Second -Ensure the app has the required permissions. The symptom for this that you get a permanent error notification - 'error_audio_error` when starting a listen session. Here's a Stack Overflow post that addresses that - https://stackoverflow.com/questions/46376193/android-speechrecognizer-audio-recording-error - Here's the important excerpt: - >You should go to system setting, Apps, Google app, then enable its permission of microphone. - -### iOS recognition guidelines -Apple has quite a good guide on the user experience for using speech, the original is here -https://developer.apple.com/documentation/speech/sfspeechrecognizer This is the section that I think is particularly relevant: - ->#### Create a Great User Experience for Speech Recognition ->Here are some tips to consider when adding speech recognition support to your app. - ->**Be prepared to handle failures caused by speech recognition limits.** Because speech recognition is a network-based service, limits are enforced so that the service can remain freely available to all apps. Individual devices may be limited in the number of recognitions that can be performed per day, and each app may be throttled globally based on the number of requests it makes per day. If a recognition request fails quickly (within a second or two of starting), check to see if the recognition service became unavailable. If it is, you may want to ask users to try again later. - ->**Plan for a one-minute limit on audio duration.** Speech recognition places a relatively high burden on battery life and network usage. To minimize this burden, the framework stops speech recognition tasks that last longer than one minute. This limit is similar to the one for keyboard-related dictation. -Remind the user when your app is recording. For example, display a visual indicator and play sounds at the beginning and end of speech recognition to help users understand that they're being actively recorded. You can also display speech as it is being recognized so that users understand what your app is doing and see any mistakes made during the recognition process. - ->**Do not perform speech recognition on private or sensitive information.** Some speech is not appropriate for recognition. Don't send passwords, health or financial data, and other sensitive speech for recognition. diff --git a/speech_to_text/android/.classpath b/speech_to_text/android/.classpath deleted file mode 100644 index eb19361b..00000000 --- a/speech_to_text/android/.classpath +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/speech_to_text/android/.gitignore b/speech_to_text/android/.gitignore deleted file mode 100644 index c6cbe562..00000000 --- a/speech_to_text/android/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -*.iml -.gradle -/local.properties -/.idea/workspace.xml -/.idea/libraries -.DS_Store -/build -/captures diff --git a/speech_to_text/android/.project b/speech_to_text/android/.project deleted file mode 100644 index 3050653c..00000000 --- a/speech_to_text/android/.project +++ /dev/null @@ -1,23 +0,0 @@ - - - speech_to_text - Project android_____ created by Buildship. - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.buildship.core.gradleprojectbuilder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.buildship.core.gradleprojectnature - - diff --git a/speech_to_text/android/.settings/org.eclipse.buildship.core.prefs b/speech_to_text/android/.settings/org.eclipse.buildship.core.prefs deleted file mode 100644 index 7a23d112..00000000 --- a/speech_to_text/android/.settings/org.eclipse.buildship.core.prefs +++ /dev/null @@ -1,13 +0,0 @@ -arguments= -auto.sync=false -build.scans.enabled=false -connection.gradle.distribution=GRADLE_DISTRIBUTION(VERSION(5.6.1)) -connection.project.dir= -eclipse.preferences.version=1 -gradle.user.home= -java.home= -jvm.arguments= -offline.mode=false -override.workspace.settings=true -show.console.view=true -show.executions.view=true diff --git a/speech_to_text/android/build.gradle b/speech_to_text/android/build.gradle deleted file mode 100644 index cc06ea57..00000000 --- a/speech_to_text/android/build.gradle +++ /dev/null @@ -1,44 +0,0 @@ -group 'com.csdcorp.speech_to_text' -version '1.0-SNAPSHOT' - -buildscript { - ext.kotlin_version = '1.3.50' - repositories { - google() - jcenter() - } - - dependencies { - classpath 'com.android.tools.build:gradle:3.5.0' - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - } -} - -rootProject.allprojects { - repositories { - google() - jcenter() - } -} - -apply plugin: 'com.android.library' -apply plugin: 'kotlin-android' - -android { - compileSdkVersion 28 - - sourceSets { - main.java.srcDirs += 'src/main/kotlin' - } - defaultConfig { - minSdkVersion 18 - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - } - lintOptions { - disable 'InvalidPackage' - } -} - -dependencies { - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" -} diff --git a/speech_to_text/android/gradle/gradle.properties b/speech_to_text/android/gradle/gradle.properties deleted file mode 100644 index 94adc3a3..00000000 --- a/speech_to_text/android/gradle/gradle.properties +++ /dev/null @@ -1,3 +0,0 @@ -org.gradle.jvmargs=-Xmx1536M -android.useAndroidX=true -android.enableJetifier=true diff --git a/speech_to_text/android/gradle/local.properties b/speech_to_text/android/gradle/local.properties deleted file mode 100644 index b85628e7..00000000 --- a/speech_to_text/android/gradle/local.properties +++ /dev/null @@ -1,2 +0,0 @@ -sdk.dir=/Users/stephen.owens/Library/Android/sdk -flutter.sdk=/Users/stephen.owens/Documents/dev/flutter/sdk/flutter \ No newline at end of file diff --git a/speech_to_text/android/gradle/settings.gradle b/speech_to_text/android/gradle/settings.gradle deleted file mode 100644 index cdfc1c4b..00000000 --- a/speech_to_text/android/gradle/settings.gradle +++ /dev/null @@ -1 +0,0 @@ -rootProject.name = 'speech_to_text' diff --git a/speech_to_text/android/gradle/wrapper/gradle-wrapper.properties b/speech_to_text/android/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index 674bdda0..00000000 --- a/speech_to_text/android/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,5 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip diff --git a/speech_to_text/android/src/main/AndroidManifest.xml b/speech_to_text/android/src/main/AndroidManifest.xml deleted file mode 100644 index 61a73f32..00000000 --- a/speech_to_text/android/src/main/AndroidManifest.xml +++ /dev/null @@ -1,3 +0,0 @@ - - diff --git a/speech_to_text/android/src/main/kotlin/com/csdcorp/speech_to_text/SpeechToTextPlugin.kt b/speech_to_text/android/src/main/kotlin/com/csdcorp/speech_to_text/SpeechToTextPlugin.kt deleted file mode 100644 index 7954add3..00000000 --- a/speech_to_text/android/src/main/kotlin/com/csdcorp/speech_to_text/SpeechToTextPlugin.kt +++ /dev/null @@ -1,595 +0,0 @@ -package com.csdcorp.speech_to_text - -import androidx.annotation.NonNull; -import io.flutter.embedding.engine.plugins.FlutterPlugin -import android.Manifest -import android.annotation.TargetApi -import android.app.Activity -import android.content.Intent -import android.content.pm.PackageManager -import android.os.Build -import android.os.Bundle -import android.speech.RecognitionListener -import android.speech.SpeechRecognizer.createSpeechRecognizer -import android.speech.RecognizerIntent -import android.speech.SpeechRecognizer -import androidx.core.app.ActivityCompat -import androidx.core.content.ContextCompat -import io.flutter.plugin.common.MethodCall -import io.flutter.plugin.common.MethodChannel -import io.flutter.plugin.common.MethodChannel.MethodCallHandler -import io.flutter.plugin.common.MethodChannel.Result -import io.flutter.plugin.common.PluginRegistry -import io.flutter.plugin.common.PluginRegistry.Registrar -import org.json.JSONObject -import android.content.Context -import android.content.BroadcastReceiver -import android.os.Handler -import android.os.Looper -import android.util.Log -import io.flutter.embedding.engine.plugins.activity.ActivityAware -import io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding -import io.flutter.plugin.common.BinaryMessenger -import org.json.JSONArray -import java.util.* - - -enum class SpeechToTextErrors { - multipleRequests, - unimplemented, - noLanguageIntent, - recognizerNotAvailable, - missingOrInvalidArg, - unknown -} - -enum class SpeechToTextCallbackMethods { - textRecognition, - notifyStatus, - notifyError, - soundLevelChange, -} - -enum class SpeechToTextStatus { - listening, - notListening, - unavailable, - available, -} - -enum class ListenMode { - deviceDefault, - dictation, - search, - confirmation, -} - -const val pluginChannelName = "plugin.csdcorp.com/speech_to_text" - -@TargetApi(8) -/** SpeechToTextPlugin */ -public class SpeechToTextPlugin : - MethodCallHandler, RecognitionListener, - PluginRegistry.RequestPermissionsResultListener, FlutterPlugin, - ActivityAware { - private var pluginContext: Context? = null - private var channel: MethodChannel? = null - private val minSdkForSpeechSupport = 21 - private val speechToTextPermissionCode = 28521 - private val missingConfidence: Double = -1.0 - private val logTag = "SpeechToTextPlugin" - private var currentActivity: Activity? = null - private var activeResult: Result? = null - private var initializedSuccessfully: Boolean = false - private var permissionToRecordAudio: Boolean = false - private var listening = false - private var debugLogging: Boolean = false - private var speechRecognizer: SpeechRecognizer? = null - private var recognizerIntent: Intent? = null - private var previousRecognizerLang: String? = null - private var previousPartialResults: Boolean = true - private var previousListenMode: ListenMode = ListenMode.deviceDefault - private var lastFinalTime: Long = 0 - private val handler: Handler = Handler(Looper.getMainLooper()) - private val defaultLanguageTag: String = Locale.getDefault().toLanguageTag() - - override fun onAttachedToEngine(@NonNull flutterPluginBinding: FlutterPlugin.FlutterPluginBinding) { - - onAttachedToEngine(flutterPluginBinding.getApplicationContext(), flutterPluginBinding.getBinaryMessenger()); - } - - // This static function is optional and equivalent to onAttachedToEngine. It supports the old - // pre-Flutter-1.12 Android projects. You are encouraged to continue supporting - // plugin registration via this function while apps migrate to use the new Android APIs - // post-flutter-1.12 via https://flutter.dev/go/android-project-migration. - // - // It is encouraged to share logic between onAttachedToEngine and registerWith to keep - // them functionally equivalent. Only one of onAttachedToEngine or registerWith will be called - // depending on the user's project. onAttachedToEngine or registerWith must both be defined - // in the same class. - companion object { - @JvmStatic - fun registerWith(registrar: Registrar) { - val speechPlugin = SpeechToTextPlugin() - speechPlugin.currentActivity = registrar.activity() - registrar.addRequestPermissionsResultListener(speechPlugin) - speechPlugin.onAttachedToEngine(registrar.context(), registrar.messenger()) - } - } - - private fun onAttachedToEngine(applicationContext: Context, messenger: BinaryMessenger) { - this.pluginContext = applicationContext; - channel = MethodChannel(messenger, pluginChannelName) - channel?.setMethodCallHandler(this) - } - - override fun onDetachedFromEngine(@NonNull binding: FlutterPlugin.FlutterPluginBinding) { - this.pluginContext = null; - channel?.setMethodCallHandler(null) - channel = null - } - - override fun onDetachedFromActivity() { - currentActivity = null - } - - override fun onReattachedToActivityForConfigChanges(binding: ActivityPluginBinding) { - currentActivity = binding.activity - binding.addRequestPermissionsResultListener(this) - } - - override fun onAttachedToActivity(binding: ActivityPluginBinding) { - currentActivity = binding.activity - binding.addRequestPermissionsResultListener(this) - } - - override fun onDetachedFromActivityForConfigChanges() { - currentActivity = null - } - - override fun onMethodCall(@NonNull call: MethodCall, @NonNull rawrResult: Result) { - val result = ChannelResultWrapper(rawrResult) - try { - when (call.method) { - "has_permission" -> hasPermission(result) - "initialize" -> { - var dlog = call.argument("debugLogging") - if (null != dlog) { - debugLogging = dlog - } - initialize(result) - } - "listen" -> { - var localeId = call.argument("localeId") - if (null == localeId) { - localeId = defaultLanguageTag - } - var partialResults = call.argument("partialResults") - if (null == partialResults) { - partialResults = true - } - val listenModeIndex = call.argument("listenMode") - if ( null == listenModeIndex ) { - result.error(SpeechToTextErrors.missingOrInvalidArg.name, - "listenMode is required", null) - return - } - startListening(result, localeId, partialResults, listenModeIndex ) - } - "stop" -> stopListening(result) - "cancel" -> cancelListening(result) - "locales" -> locales(result) - else -> result.notImplemented() - } - } catch (exc: Exception) { - Log.e(logTag, "Unexpected exception", exc) - result.error(SpeechToTextErrors.unknown.name, - "Unexpected exception", exc.localizedMessage) - } - } - - private fun hasPermission(result: Result) { - if (sdkVersionTooLow(result)) { - return - } - debugLog("Start has_permission") - val localContext = pluginContext - if (localContext != null) { - val hasPerm = ContextCompat.checkSelfPermission(localContext, - Manifest.permission.RECORD_AUDIO) == PackageManager.PERMISSION_GRANTED - result.success(hasPerm) - } - } - - private fun initialize(result: Result) { - if (sdkVersionTooLow(result)) { - return - } - debugLog("Start initialize") - if (null != activeResult) { - result.error(SpeechToTextErrors.multipleRequests.name, - "Only one initialize at a time", null) - return - } - activeResult = result - val localContext = pluginContext - initializeIfPermitted(pluginContext) - } - - private fun sdkVersionTooLow(result: Result): Boolean { - if (Build.VERSION.SDK_INT < minSdkForSpeechSupport) { - result.success(false) - return true; - } - return false; - } - - private fun isNotInitialized(result: Result): Boolean { - if (!initializedSuccessfully || null == pluginContext) { - result.success(false) - } - return !initializedSuccessfully - } - - private fun isListening(): Boolean { - return listening - } - - private fun isNotListening(): Boolean { - return !listening - } - - private fun startListening(result: Result, languageTag: String, partialResults: Boolean, - listenModeIndex: Int) { - if (sdkVersionTooLow(result) || isNotInitialized(result) || isListening()) { - return - } - debugLog("Start listening") - var listenMode = ListenMode.deviceDefault - if ( listenModeIndex == ListenMode.dictation.ordinal) { - listenMode = ListenMode.dictation - } - setupRecognizerIntent(languageTag, partialResults, listenMode) - handler.post { - run { - speechRecognizer?.startListening(recognizerIntent) - } - } - notifyListening(isRecording = true) - result.success(true) - debugLog("Start listening done") - } - - private fun stopListening(result: Result) { - if (sdkVersionTooLow(result) || isNotInitialized(result) || isNotListening()) { - return - } - debugLog("Stop listening") - handler.post { - run { - speechRecognizer?.stopListening() - } - } - notifyListening(isRecording = false) - result.success(true) - debugLog("Stop listening done") - } - - private fun cancelListening(result: Result) { - if (sdkVersionTooLow(result) || isNotInitialized(result) || isNotListening()) { - return - } - debugLog("Cancel listening") - handler.post { - run { - speechRecognizer?.cancel() - } - } - notifyListening(isRecording = false) - result.success(true) - debugLog("Cancel listening done") - } - - private fun locales(result: Result) { - if (sdkVersionTooLow(result) || isNotInitialized(result)) { - return - } - var detailsIntent = RecognizerIntent.getVoiceDetailsIntent(pluginContext) - if (null == detailsIntent) { - detailsIntent = Intent(RecognizerIntent.ACTION_GET_LANGUAGE_DETAILS) - } - if (null == detailsIntent) { - result.error(SpeechToTextErrors.noLanguageIntent.name, - "Could not get voice details", null) - return - } - pluginContext?.sendOrderedBroadcast( - detailsIntent, null, LanguageDetailsChecker(result), - null, Activity.RESULT_OK, null, null) - } - - private fun notifyListening(isRecording: Boolean) { - debugLog("Notify listening") - listening = isRecording - val status = when (isRecording) { - true -> SpeechToTextStatus.listening.name - false -> SpeechToTextStatus.notListening.name - } - channel?.invokeMethod(SpeechToTextCallbackMethods.notifyStatus.name, status) - debugLog("Notify listening done") - } - - private fun updateResults(speechBundle: Bundle?, isFinal: Boolean) { - if (isDuplicateFinal( isFinal )) { - debugLog("Discarding duplicate final") - return - } - val userSaid = speechBundle?.getStringArrayList(SpeechRecognizer.RESULTS_RECOGNITION) - if (null != userSaid && userSaid.isNotEmpty()) { - val speechResult = JSONObject() - speechResult.put("finalResult", isFinal) - val confidence = speechBundle?.getFloatArray(SpeechRecognizer.CONFIDENCE_SCORES) - val alternates = JSONArray() - for (resultIndex in 0..userSaid.size - 1) { - val speechWords = JSONObject() - speechWords.put("recognizedWords", userSaid[resultIndex]) - if (null != confidence && confidence.size >= userSaid.size) { - speechWords.put("confidence", confidence[resultIndex]) - } else { - speechWords.put("confidence", missingConfidence) - } - alternates.put(speechWords) - } - speechResult.put("alternates", alternates) - val jsonResult = speechResult.toString() - debugLog("Calling results callback") - channel?.invokeMethod(SpeechToTextCallbackMethods.textRecognition.name, - jsonResult) - } - } - - private fun isDuplicateFinal( isFinal: Boolean ) : Boolean { - if ( !isFinal ) { - return false - } - val delta = System.currentTimeMillis() - lastFinalTime - lastFinalTime = System.currentTimeMillis() - return delta >= 0 && delta < 100 - } - - private fun initializeIfPermitted(context: Context?) { - val localContext = context - if (null == localContext) { - completeInitialize() - return - } - permissionToRecordAudio = ContextCompat.checkSelfPermission(localContext, - Manifest.permission.RECORD_AUDIO) == PackageManager.PERMISSION_GRANTED - debugLog("Checked permission") - if (!permissionToRecordAudio) { - val localActivity = currentActivity - if (null != localActivity) { - debugLog("Requesting permission") - ActivityCompat.requestPermissions(localActivity, - arrayOf(Manifest.permission.RECORD_AUDIO), speechToTextPermissionCode) - } else { - debugLog("no permission, no activity, completing") - completeInitialize() - } - } else { - debugLog("has permission, completing") - completeInitialize() - } - debugLog("leaving initializeIfPermitted") - } - - private fun completeInitialize() { - - debugLog("completeInitialize") - if (permissionToRecordAudio) { - debugLog("Testing recognition availability") - if (!SpeechRecognizer.isRecognitionAvailable(pluginContext)) { - Log.e(logTag, "Speech recognition not available on this device") - activeResult?.error(SpeechToTextErrors.recognizerNotAvailable.name, - "Speech recognition not available on this device", "") - activeResult = null - return - } - - debugLog("Creating recognizer") - speechRecognizer = createSpeechRecognizer(pluginContext).apply { - debugLog("Setting listener") - setRecognitionListener(this@SpeechToTextPlugin) - } - if (null == speechRecognizer) { - Log.e(logTag, "Speech recognizer null") - activeResult?.error( - SpeechToTextErrors.recognizerNotAvailable.name, - "Speech recognizer null", "") - activeResult = null - } - - debugLog("before setup intent") - setupRecognizerIntent(defaultLanguageTag, true, ListenMode.deviceDefault) - debugLog("after setup intent") - } - - initializedSuccessfully = permissionToRecordAudio - debugLog("sending result") - activeResult?.success(permissionToRecordAudio) - debugLog("leaving complete") - activeResult = null - } - - private fun setupRecognizerIntent(languageTag: String, partialResults: Boolean, listenMode: ListenMode) { - debugLog("setupRecognizerIntent") - if (previousRecognizerLang == null || - previousRecognizerLang != languageTag || - partialResults != previousPartialResults || previousListenMode != listenMode ) { - previousRecognizerLang = languageTag; - previousPartialResults = partialResults - previousListenMode = listenMode - handler.post { - run { - recognizerIntent = Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH).apply { - debugLog("In RecognizerIntent apply") - putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM) - debugLog("put model") - val localContext = pluginContext - if (null != localContext) { - putExtra(RecognizerIntent.EXTRA_CALLING_PACKAGE, - localContext.applicationInfo.packageName) - } - debugLog("put package") - putExtra(RecognizerIntent.EXTRA_PARTIAL_RESULTS, partialResults) - debugLog("put partial") - if (languageTag != Locale.getDefault().toLanguageTag()) { - putExtra(RecognizerIntent.EXTRA_LANGUAGE, languageTag); - debugLog("put languageTag") - } - } - } - } - } - } - - override fun onRequestPermissionsResult(requestCode: Int, permissions: Array?, - grantResults: IntArray?): Boolean { - when (requestCode) { - speechToTextPermissionCode -> { - if (null != grantResults) { - permissionToRecordAudio = grantResults.isNotEmpty() && - grantResults.get(0) == PackageManager.PERMISSION_GRANTED - } - completeInitialize() - return true - } - } - return false - } - - - override fun onPartialResults(results: Bundle?) = updateResults(results, false) - override fun onResults(results: Bundle?) = updateResults(results, true) - override fun onEndOfSpeech() = notifyListening(isRecording = false) - - override fun onError(errorCode: Int) { - val errorMsg = when (errorCode) { - SpeechRecognizer.ERROR_AUDIO -> "error_audio_error" - SpeechRecognizer.ERROR_CLIENT -> "error_client" - SpeechRecognizer.ERROR_INSUFFICIENT_PERMISSIONS -> "error_permission" - SpeechRecognizer.ERROR_NETWORK -> "error_network" - SpeechRecognizer.ERROR_NETWORK_TIMEOUT -> "error_network_timeout" - SpeechRecognizer.ERROR_NO_MATCH -> "error_no_match" - SpeechRecognizer.ERROR_RECOGNIZER_BUSY -> "error_busy" - SpeechRecognizer.ERROR_SERVER -> "error_server" - SpeechRecognizer.ERROR_SPEECH_TIMEOUT -> "error_speech_timeout" - else -> "error_unknown" - } - sendError(errorMsg) - } - - private fun debugLog( msg: String ) { - if ( debugLogging ) { - Log.d( logTag, msg ) - } - } - - private fun sendError(errorMsg: String) { - val speechError = JSONObject() - speechError.put("errorMsg", errorMsg) - speechError.put("permanent", true) - handler.post { - run { - channel?.invokeMethod(SpeechToTextCallbackMethods.notifyError.name, speechError.toString()) - } - } - } - - override fun onRmsChanged(rmsdB: Float) { - handler.post { - run { - channel?.invokeMethod(SpeechToTextCallbackMethods.soundLevelChange.name, rmsdB) - } - } - } - - override fun onReadyForSpeech(p0: Bundle?) {} - override fun onBufferReceived(p0: ByteArray?) {} - override fun onEvent(p0: Int, p1: Bundle?) {} - override fun onBeginningOfSpeech() {} -} - -// See https://stackoverflow.com/questions/10538791/how-to-set-the-language-in-speech-recognition-on-android/10548680#10548680 -class LanguageDetailsChecker(flutterResult: Result) : BroadcastReceiver() { - private val result: Result = flutterResult - private var supportedLanguages: List? = null - - private var languagePreference: String? = null - - override fun onReceive(context: Context, intent: Intent) { - val results = getResultExtras(true) - if (results.containsKey(RecognizerIntent.EXTRA_LANGUAGE_PREFERENCE)) { - languagePreference = results.getString(RecognizerIntent.EXTRA_LANGUAGE_PREFERENCE) - } - if (results.containsKey(RecognizerIntent.EXTRA_SUPPORTED_LANGUAGES)) { - supportedLanguages = results.getStringArrayList( - RecognizerIntent.EXTRA_SUPPORTED_LANGUAGES) - createResponse(supportedLanguages) - } - } - - private fun createResponse(supportedLanguages: List?) { - val currentLocale = Locale.getDefault() - val localeNames = ArrayList() - localeNames.add(buildIdNameForLocale(currentLocale)) - if (null != supportedLanguages) { - for (lang in supportedLanguages) { - if (currentLocale.toLanguageTag() == lang) { - continue - } - val locale = Locale.forLanguageTag(lang) - localeNames.add(buildIdNameForLocale(locale)) - } - } - result.success(localeNames) - - } - - private fun buildIdNameForLocale(locale: Locale): String { - val name = locale.displayName.replace(':', ' ') - return "${locale.language}_${locale.country}:$name" - } -} - -private class ChannelResultWrapper(result: Result) : Result { - // Caller handler - val handler: Handler = Handler(Looper.getMainLooper()) - val result: Result = result - - // make sure to respond in the caller thread - override fun success(results: Any?) { - - handler.post { - run { - result.success(results); - } - } - } - - override fun error(errorCode: String?, errorMessage: String?, data: Any?) { - handler.post { - run { - result.error(errorCode, errorMessage, data); - } - } - } - - override fun notImplemented() { - handler.post { - run { - result.notImplemented(); - } - } - } -} diff --git a/speech_to_text/example/.gitignore b/speech_to_text/example/.gitignore deleted file mode 100644 index 2ddde2a5..00000000 --- a/speech_to_text/example/.gitignore +++ /dev/null @@ -1,73 +0,0 @@ -# Miscellaneous -*.class -*.log -*.pyc -*.swp -.DS_Store -.atom/ -.buildlog/ -.history -.svn/ - -# IntelliJ related -*.iml -*.ipr -*.iws -.idea/ - -# The .vscode folder contains launch configuration and tasks you configure in -# VS Code which you may wish to be included in version control, so this line -# is commented out by default. -#.vscode/ - -# Flutter/Dart/Pub related -**/doc/api/ -.dart_tool/ -.flutter-plugins -.packages -.pub-cache/ -.pub/ -/build/ - -# Android related -**/android/**/gradle-wrapper.jar -**/android/.gradle -**/android/captures/ -**/android/gradlew -**/android/gradlew.bat -**/android/local.properties -**/android/**/GeneratedPluginRegistrant.java - -# iOS/XCode related -**/ios/**/*.mode1v3 -**/ios/**/*.mode2v3 -**/ios/**/*.moved-aside -**/ios/**/*.pbxuser -**/ios/**/*.perspectivev3 -**/ios/**/*sync/ -**/ios/**/.sconsign.dblite -**/ios/**/.tags* -**/ios/**/.vagrant/ -**/ios/**/DerivedData/ -**/ios/**/Icon? -**/ios/**/Pods/ -**/ios/**/.symlinks/ -**/ios/**/profile -**/ios/**/xcuserdata -**/ios/.generated/ -**/ios/Flutter/App.framework -**/ios/Flutter/Flutter.framework -**/ios/Flutter/Generated.xcconfig -**/ios/Flutter/app.flx -**/ios/Flutter/app.zip -**/ios/Flutter/flutter_assets/ -**/ios/Flutter/flutter_export_environment.sh -**/ios/ServiceDefinitions.json -**/ios/Runner/GeneratedPluginRegistrant.* - -# Exceptions to above rules. -!**/ios/**/default.mode1v3 -!**/ios/**/default.mode2v3 -!**/ios/**/default.pbxuser -!**/ios/**/default.perspectivev3 -!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages diff --git a/speech_to_text/example/.metadata b/speech_to_text/example/.metadata deleted file mode 100644 index aeb01ee2..00000000 --- a/speech_to_text/example/.metadata +++ /dev/null @@ -1,10 +0,0 @@ -# This file tracks properties of this Flutter project. -# Used by Flutter tool to assess capabilities and perform upgrades etc. -# -# This file should be version controlled and should not be manually edited. - -version: - revision: 2d2a1ffec95cc70a3218872a2cd3f8de4933c42f - channel: stable - -project_type: app diff --git a/speech_to_text/example/README.md b/speech_to_text/example/README.md deleted file mode 100644 index 92252821..00000000 --- a/speech_to_text/example/README.md +++ /dev/null @@ -1,155 +0,0 @@ -# speech_to_text_example - -Demonstrates how to use the speech_to_text plugin. This example requires -that the plugin has been installed. It initializes speech recognition, -listens for words and prints them. - - -## Source - -```dart -import 'package:flutter/material.dart'; -import 'dart:async'; - -import 'package:speech_to_text/speech_to_text.dart'; -import 'package:speech_to_text/speech_recognition_result.dart'; -import 'package:speech_to_text/speech_recognition_error.dart'; - -void main() => runApp(MyApp()); - -class MyApp extends StatefulWidget { - @override - _MyAppState createState() => _MyAppState(); -} - -class _MyAppState extends State { - bool _hasSpeech = false; - String lastWords = ""; - String lastError = ""; - String lastStatus = ""; - final SpeechToText speech = SpeechToText(); - - @override - void initState() { - super.initState(); - initSpeechState(); - } - - Future initSpeechState() async { - bool hasSpeech = await speech.initialize(onError: errorListener, onStatus: statusListener ); - - if (!mounted) return; - setState(() { - _hasSpeech = hasSpeech; - }); - } - - @override - Widget build(BuildContext context) { - return MaterialApp( - home: Scaffold( - appBar: AppBar( - title: const Text('Speech to Text Example'), - ), - body: _hasSpeech - ? Column(children: [ - Expanded( - child: Center( - child: Text('Speech recognition available'), - ), - ), - Expanded( - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - FlatButton( - child: Text('Start'), - onPressed: startListening, - ), - FlatButton( - child: Text('Stop'), - onPressed: stopListening, - ), - FlatButton( - child: Text('Cancel'), - onPressed:cancelListening, - ), - ], - ), - ), - Expanded( - child: Column( - children: [ - Center( - child: Text('Recognized Words'), - ), - Center( - child: Text(lastWords), - ), - ], - ), - ), - Expanded( - child: Column( - children: [ - Center( - child: Text('Error'), - ), - Center( - child: Text(lastError), - ), - ], - ), - ), - Expanded( - child: Center( - child: speech.isListening ? Text("I'm listening...") : Text( 'Not listening' ), - ), - ), - ]) - : Center( child: Text('Speech recognition unavailable', style: TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold))), - ), - ); - } - - void startListening() { - lastWords = ""; - lastError = ""; - speech.listen(onResult: resultListener ); - setState(() { - - }); - } - - void stopListening() { - speech.stop( ); - setState(() { - - }); - } - - void cancelListening() { - speech.cancel( ); - setState(() { - - }); - } - - void resultListener(SpeechRecognitionResult result) { - setState(() { - lastWords = "${result.recognizedWords} - ${result.finalResult}"; - }); - } - - void errorListener(SpeechRecognitionError error ) { - setState(() { - lastError = "${error.errorMsg} - ${error.permanent}"; - }); - } - void statusListener(String status ) { - setState(() { - lastStatus = "$status"; - }); - } -} -``` \ No newline at end of file diff --git a/speech_to_text/example/android/.project b/speech_to_text/example/android/.project deleted file mode 100644 index d7d48141..00000000 --- a/speech_to_text/example/android/.project +++ /dev/null @@ -1,17 +0,0 @@ - - - android___ - Project android___ created by Buildship. - - - - - org.eclipse.buildship.core.gradleprojectbuilder - - - - - - org.eclipse.buildship.core.gradleprojectnature - - diff --git a/speech_to_text/example/android/.settings/org.eclipse.buildship.core.prefs b/speech_to_text/example/android/.settings/org.eclipse.buildship.core.prefs deleted file mode 100644 index e8895216..00000000 --- a/speech_to_text/example/android/.settings/org.eclipse.buildship.core.prefs +++ /dev/null @@ -1,2 +0,0 @@ -connection.project.dir= -eclipse.preferences.version=1 diff --git a/speech_to_text/example/android/app/build.gradle b/speech_to_text/example/android/app/build.gradle deleted file mode 100644 index 104069d3..00000000 --- a/speech_to_text/example/android/app/build.gradle +++ /dev/null @@ -1,67 +0,0 @@ -def localProperties = new Properties() -def localPropertiesFile = rootProject.file('local.properties') -if (localPropertiesFile.exists()) { - localPropertiesFile.withReader('UTF-8') { reader -> - localProperties.load(reader) - } -} - -def flutterRoot = localProperties.getProperty('flutter.sdk') -if (flutterRoot == null) { - throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") -} - -def flutterVersionCode = localProperties.getProperty('flutter.versionCode') -if (flutterVersionCode == null) { - flutterVersionCode = '1' -} - -def flutterVersionName = localProperties.getProperty('flutter.versionName') -if (flutterVersionName == null) { - flutterVersionName = '1.0' -} - -apply plugin: 'com.android.application' -apply plugin: 'kotlin-android' -apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" - -android { - compileSdkVersion 28 - - sourceSets { - main.java.srcDirs += 'src/main/kotlin' - } - - lintOptions { - disable 'InvalidPackage' - } - - defaultConfig { - // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). - applicationId "com.csdcorp.speech_to_text_example" - minSdkVersion 18 - targetSdkVersion 28 - versionCode flutterVersionCode.toInteger() - versionName flutterVersionName - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - } - - buildTypes { - release { - // TODO: Add your own signing config for the release build. - // Signing with the debug keys for now, so `flutter run --release` works. - signingConfig signingConfigs.debug - } - } -} - -flutter { - source '../..' -} - -dependencies { - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" - testImplementation 'junit:junit:4.12' - androidTestImplementation 'androidx.test:runner:1.1.1' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' -} diff --git a/speech_to_text/example/android/app/src/debug/AndroidManifest.xml b/speech_to_text/example/android/app/src/debug/AndroidManifest.xml deleted file mode 100644 index 36edf838..00000000 --- a/speech_to_text/example/android/app/src/debug/AndroidManifest.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - diff --git a/speech_to_text/example/android/app/src/main/AndroidManifest.xml b/speech_to_text/example/android/app/src/main/AndroidManifest.xml deleted file mode 100644 index b0912061..00000000 --- a/speech_to_text/example/android/app/src/main/AndroidManifest.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/speech_to_text/example/android/app/src/main/kotlin/com/csdcorp/speech_to_text_example/MainActivity.kt b/speech_to_text/example/android/app/src/main/kotlin/com/csdcorp/speech_to_text_example/MainActivity.kt deleted file mode 100644 index f44e470e..00000000 --- a/speech_to_text/example/android/app/src/main/kotlin/com/csdcorp/speech_to_text_example/MainActivity.kt +++ /dev/null @@ -1,12 +0,0 @@ -package com.csdcorp.speech_to_text_example - -import androidx.annotation.NonNull; -import io.flutter.embedding.android.FlutterActivity -import io.flutter.embedding.engine.FlutterEngine -import io.flutter.plugins.GeneratedPluginRegistrant - -class MainActivity: FlutterActivity() { - override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) { - GeneratedPluginRegistrant.registerWith(flutterEngine); - } -} diff --git a/speech_to_text/example/android/app/src/main/res/drawable/launch_background.xml b/speech_to_text/example/android/app/src/main/res/drawable/launch_background.xml deleted file mode 100644 index 304732f8..00000000 --- a/speech_to_text/example/android/app/src/main/res/drawable/launch_background.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - diff --git a/speech_to_text/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/speech_to_text/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png deleted file mode 100644 index db77bb4b..00000000 Binary files a/speech_to_text/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png and /dev/null differ diff --git a/speech_to_text/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/speech_to_text/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png deleted file mode 100644 index 17987b79..00000000 Binary files a/speech_to_text/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png and /dev/null differ diff --git a/speech_to_text/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/speech_to_text/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png deleted file mode 100644 index 09d43914..00000000 Binary files a/speech_to_text/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png and /dev/null differ diff --git a/speech_to_text/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/speech_to_text/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png deleted file mode 100644 index d5f1c8d3..00000000 Binary files a/speech_to_text/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png and /dev/null differ diff --git a/speech_to_text/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/speech_to_text/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png deleted file mode 100644 index 4d6372ee..00000000 Binary files a/speech_to_text/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png and /dev/null differ diff --git a/speech_to_text/example/android/app/src/main/res/values/styles.xml b/speech_to_text/example/android/app/src/main/res/values/styles.xml deleted file mode 100644 index 00fa4417..00000000 --- a/speech_to_text/example/android/app/src/main/res/values/styles.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - diff --git a/speech_to_text/example/android/app/src/profile/AndroidManifest.xml b/speech_to_text/example/android/app/src/profile/AndroidManifest.xml deleted file mode 100644 index 36edf838..00000000 --- a/speech_to_text/example/android/app/src/profile/AndroidManifest.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - diff --git a/speech_to_text/example/android/build.gradle b/speech_to_text/example/android/build.gradle deleted file mode 100644 index 13546311..00000000 --- a/speech_to_text/example/android/build.gradle +++ /dev/null @@ -1,31 +0,0 @@ -buildscript { - ext.kotlin_version = '1.3.50' - repositories { - google() - jcenter() - } - - dependencies { - classpath 'com.android.tools.build:gradle:3.6.1' - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - } -} - -allprojects { - repositories { - google() - jcenter() - } -} - -rootProject.buildDir = '../build' -subprojects { - project.buildDir = "${rootProject.buildDir}/${project.name}" -} -subprojects { - project.evaluationDependsOn(':app') -} - -task clean(type: Delete) { - delete rootProject.buildDir -} diff --git a/speech_to_text/example/android/gradle.properties b/speech_to_text/example/android/gradle.properties deleted file mode 100644 index a6738207..00000000 --- a/speech_to_text/example/android/gradle.properties +++ /dev/null @@ -1,4 +0,0 @@ -org.gradle.jvmargs=-Xmx1536M -android.useAndroidX=true -android.enableJetifier=true -android.enableR8=true diff --git a/speech_to_text/example/android/gradle/wrapper/gradle-wrapper.properties b/speech_to_text/example/android/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index 052e7951..00000000 --- a/speech_to_text/example/android/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,6 +0,0 @@ -#Mon Mar 16 08:57:32 EDT 2020 -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip diff --git a/speech_to_text/example/android/settings.gradle b/speech_to_text/example/android/settings.gradle deleted file mode 100644 index 5a2f14fb..00000000 --- a/speech_to_text/example/android/settings.gradle +++ /dev/null @@ -1,15 +0,0 @@ -include ':app' - -def flutterProjectRoot = rootProject.projectDir.parentFile.toPath() - -def plugins = new Properties() -def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins') -if (pluginsFile.exists()) { - pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) } -} - -plugins.each { name, path -> - def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile() - include ":$name" - project(":$name").projectDir = pluginDirectory -} diff --git a/speech_to_text/example/assets/sounds/speech_to_text_cancel.m4r b/speech_to_text/example/assets/sounds/speech_to_text_cancel.m4r deleted file mode 100644 index ccb3afe3..00000000 Binary files a/speech_to_text/example/assets/sounds/speech_to_text_cancel.m4r and /dev/null differ diff --git a/speech_to_text/example/assets/sounds/speech_to_text_listening.m4r b/speech_to_text/example/assets/sounds/speech_to_text_listening.m4r deleted file mode 100644 index 3131d60f..00000000 Binary files a/speech_to_text/example/assets/sounds/speech_to_text_listening.m4r and /dev/null differ diff --git a/speech_to_text/example/assets/sounds/speech_to_text_stop.m4r b/speech_to_text/example/assets/sounds/speech_to_text_stop.m4r deleted file mode 100644 index 8817f01b..00000000 Binary files a/speech_to_text/example/assets/sounds/speech_to_text_stop.m4r and /dev/null differ diff --git a/speech_to_text/example/ios/Flutter/AppFrameworkInfo.plist b/speech_to_text/example/ios/Flutter/AppFrameworkInfo.plist deleted file mode 100644 index 6b4c0f78..00000000 --- a/speech_to_text/example/ios/Flutter/AppFrameworkInfo.plist +++ /dev/null @@ -1,26 +0,0 @@ - - - - - CFBundleDevelopmentRegion - $(DEVELOPMENT_LANGUAGE) - CFBundleExecutable - App - CFBundleIdentifier - io.flutter.flutter.app - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - App - CFBundlePackageType - FMWK - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1.0 - MinimumOSVersion - 8.0 - - diff --git a/speech_to_text/example/ios/Flutter/Debug.xcconfig b/speech_to_text/example/ios/Flutter/Debug.xcconfig deleted file mode 100644 index e8efba11..00000000 --- a/speech_to_text/example/ios/Flutter/Debug.xcconfig +++ /dev/null @@ -1,2 +0,0 @@ -#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" -#include "Generated.xcconfig" diff --git a/speech_to_text/example/ios/Flutter/Flutter.podspec b/speech_to_text/example/ios/Flutter/Flutter.podspec deleted file mode 100644 index 5ca30416..00000000 --- a/speech_to_text/example/ios/Flutter/Flutter.podspec +++ /dev/null @@ -1,18 +0,0 @@ -# -# NOTE: This podspec is NOT to be published. It is only used as a local source! -# - -Pod::Spec.new do |s| - s.name = 'Flutter' - s.version = '1.0.0' - s.summary = 'High-performance, high-fidelity mobile apps.' - s.description = <<-DESC -Flutter provides an easy and productive way to build and deploy high-performance mobile apps for Android and iOS. - DESC - s.homepage = 'https://flutter.io' - s.license = { :type => 'MIT' } - s.author = { 'Flutter Dev Team' => 'flutter-dev@googlegroups.com' } - s.source = { :git => 'https://github.com/flutter/engine', :tag => s.version.to_s } - s.ios.deployment_target = '8.0' - s.vendored_frameworks = 'Flutter.framework' -end diff --git a/speech_to_text/example/ios/Flutter/Release.xcconfig b/speech_to_text/example/ios/Flutter/Release.xcconfig deleted file mode 100644 index 399e9340..00000000 --- a/speech_to_text/example/ios/Flutter/Release.xcconfig +++ /dev/null @@ -1,2 +0,0 @@ -#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" -#include "Generated.xcconfig" diff --git a/speech_to_text/example/ios/Podfile b/speech_to_text/example/ios/Podfile deleted file mode 100644 index ab7d5b46..00000000 --- a/speech_to_text/example/ios/Podfile +++ /dev/null @@ -1,90 +0,0 @@ -# Uncomment this line to define a global platform for your project -platform :ios, '10.0' - -# CocoaPods analytics sends network stats synchronously affecting flutter build latency. -ENV['COCOAPODS_DISABLE_STATS'] = 'true' - -project 'Runner', { - 'Debug' => :debug, - 'Profile' => :release, - 'Release' => :release, -} - -def parse_KV_file(file, separator='=') - file_abs_path = File.expand_path(file) - if !File.exists? file_abs_path - return []; - end - generated_key_values = {} - skip_line_start_symbols = ["#", "/"] - File.foreach(file_abs_path) do |line| - next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ } - plugin = line.split(pattern=separator) - if plugin.length == 2 - podname = plugin[0].strip() - path = plugin[1].strip() - podpath = File.expand_path("#{path}", file_abs_path) - generated_key_values[podname] = podpath - else - puts "Invalid plugin specification: #{line}" - end - end - generated_key_values -end - -target 'Runner' do - use_frameworks! - use_modular_headers! - - # Flutter Pod - - copied_flutter_dir = File.join(__dir__, 'Flutter') - copied_framework_path = File.join(copied_flutter_dir, 'Flutter.framework') - copied_podspec_path = File.join(copied_flutter_dir, 'Flutter.podspec') - unless File.exist?(copied_framework_path) && File.exist?(copied_podspec_path) - # Copy Flutter.framework and Flutter.podspec to Flutter/ to have something to link against if the xcode backend script has not run yet. - # That script will copy the correct debug/profile/release version of the framework based on the currently selected Xcode configuration. - # CocoaPods will not embed the framework on pod install (before any build phases can generate) if the dylib does not exist. - - generated_xcode_build_settings_path = File.join(copied_flutter_dir, 'Generated.xcconfig') - unless File.exist?(generated_xcode_build_settings_path) - raise "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter pub get is executed first" - end - generated_xcode_build_settings = parse_KV_file(generated_xcode_build_settings_path) - cached_framework_dir = generated_xcode_build_settings['FLUTTER_FRAMEWORK_DIR']; - - unless File.exist?(copied_framework_path) - FileUtils.cp_r(File.join(cached_framework_dir, 'Flutter.framework'), copied_flutter_dir) - end - unless File.exist?(copied_podspec_path) - FileUtils.cp(File.join(cached_framework_dir, 'Flutter.podspec'), copied_flutter_dir) - end - end - - # Keep pod path relative so it can be checked into Podfile.lock. - pod 'Flutter', :path => 'Flutter' - - # Plugin Pods - - # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock - # referring to absolute paths on developers' machines. - system('rm -rf .symlinks') - system('mkdir -p .symlinks/plugins') - plugin_pods = parse_KV_file('../.flutter-plugins') - plugin_pods.each do |name, path| - symlink = File.join('.symlinks', 'plugins', name) - File.symlink(path, symlink) - pod name, :path => File.join(symlink, 'ios') - end -end - -# Prevent Cocoapods from embedding a second Flutter framework and causing an error with the new Xcode build system. -install! 'cocoapods', :disable_input_output_paths => true - -post_install do |installer| - installer.pods_project.targets.each do |target| - target.build_configurations.each do |config| - config.build_settings['ENABLE_BITCODE'] = 'NO' - end - end -end diff --git a/speech_to_text/example/ios/Podfile.lock b/speech_to_text/example/ios/Podfile.lock deleted file mode 100644 index 60c8b57d..00000000 --- a/speech_to_text/example/ios/Podfile.lock +++ /dev/null @@ -1,29 +0,0 @@ -PODS: - - Flutter (1.0.0) - - speech_to_text (0.0.1): - - Flutter - - Try - - Try (2.1.1) - -DEPENDENCIES: - - Flutter (from `Flutter`) - - speech_to_text (from `.symlinks/plugins/speech_to_text/ios`) - -SPEC REPOS: - trunk: - - Try - -EXTERNAL SOURCES: - Flutter: - :path: Flutter - speech_to_text: - :path: ".symlinks/plugins/speech_to_text/ios" - -SPEC CHECKSUMS: - Flutter: 0e3d915762c693b495b44d77113d4970485de6ec - speech_to_text: b43a7d99aef037bd758ed8e45d79bbac035d2dfe - Try: 5ef669ae832617b3cee58cb2c6f99fb767a4ff96 - -PODFILE CHECKSUM: 0ba44ad07df4ab62269dc769727cf0f12b1e453d - -COCOAPODS: 1.9.3 diff --git a/speech_to_text/example/ios/Runner.xcodeproj/project.pbxproj b/speech_to_text/example/ios/Runner.xcodeproj/project.pbxproj deleted file mode 100644 index c40af650..00000000 --- a/speech_to_text/example/ios/Runner.xcodeproj/project.pbxproj +++ /dev/null @@ -1,578 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; - 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; - 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; - 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB21CF90195004384FC /* Debug.xcconfig */; }; - 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; - 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; - 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; - C446300A034BF27D9F1ACEF9 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E76E9615C6B4FABD88067D55 /* Pods_Runner.framework */; }; -/* End PBXBuildFile section */ - -/* Begin PBXCopyFilesBuildPhase section */ - 9705A1C41CF9048500538489 /* Embed Frameworks */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = ""; - dstSubfolderSpec = 10; - files = ( - ); - name = "Embed Frameworks"; - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXCopyFilesBuildPhase section */ - -/* Begin PBXFileReference section */ - 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; - 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; - 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; - 59AFE6BB0B596A0E0811BDFF /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; - 6280E2A777726D2043BF80B7 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; - 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; - 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; - 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; - 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; - 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; - 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; - 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; - 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; - 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; - 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - C3909A4B7EC98A20255210E3 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; - E76E9615C6B4FABD88067D55 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 97C146EB1CF9000F007C117D /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - C446300A034BF27D9F1ACEF9 /* Pods_Runner.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 7937AF765430D66F28F7FEEF /* Frameworks */ = { - isa = PBXGroup; - children = ( - E76E9615C6B4FABD88067D55 /* Pods_Runner.framework */, - ); - name = Frameworks; - sourceTree = ""; - }; - 9740EEB11CF90186004384FC /* Flutter */ = { - isa = PBXGroup; - children = ( - 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, - 9740EEB21CF90195004384FC /* Debug.xcconfig */, - 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, - 9740EEB31CF90195004384FC /* Generated.xcconfig */, - ); - name = Flutter; - sourceTree = ""; - }; - 97C146E51CF9000F007C117D = { - isa = PBXGroup; - children = ( - 9740EEB11CF90186004384FC /* Flutter */, - 97C146F01CF9000F007C117D /* Runner */, - 97C146EF1CF9000F007C117D /* Products */, - A68CCF1640763A551D35BD31 /* Pods */, - 7937AF765430D66F28F7FEEF /* Frameworks */, - ); - sourceTree = ""; - }; - 97C146EF1CF9000F007C117D /* Products */ = { - isa = PBXGroup; - children = ( - 97C146EE1CF9000F007C117D /* Runner.app */, - ); - name = Products; - sourceTree = ""; - }; - 97C146F01CF9000F007C117D /* Runner */ = { - isa = PBXGroup; - children = ( - 97C146FA1CF9000F007C117D /* Main.storyboard */, - 97C146FD1CF9000F007C117D /* Assets.xcassets */, - 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, - 97C147021CF9000F007C117D /* Info.plist */, - 97C146F11CF9000F007C117D /* Supporting Files */, - 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, - 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, - 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, - 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, - ); - path = Runner; - sourceTree = ""; - }; - 97C146F11CF9000F007C117D /* Supporting Files */ = { - isa = PBXGroup; - children = ( - ); - name = "Supporting Files"; - sourceTree = ""; - }; - A68CCF1640763A551D35BD31 /* Pods */ = { - isa = PBXGroup; - children = ( - 59AFE6BB0B596A0E0811BDFF /* Pods-Runner.debug.xcconfig */, - 6280E2A777726D2043BF80B7 /* Pods-Runner.release.xcconfig */, - C3909A4B7EC98A20255210E3 /* Pods-Runner.profile.xcconfig */, - ); - path = Pods; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 97C146ED1CF9000F007C117D /* Runner */ = { - isa = PBXNativeTarget; - buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; - buildPhases = ( - 949FCB95217187F2C022D6A9 /* [CP] Check Pods Manifest.lock */, - 9740EEB61CF901F6004384FC /* Run Script */, - 97C146EA1CF9000F007C117D /* Sources */, - 97C146EB1CF9000F007C117D /* Frameworks */, - 97C146EC1CF9000F007C117D /* Resources */, - 9705A1C41CF9048500538489 /* Embed Frameworks */, - 3B06AD1E1E4923F5004D2608 /* Thin Binary */, - 8B0988F04B6AE44AA0304FEF /* [CP] Embed Pods Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = Runner; - productName = Runner; - productReference = 97C146EE1CF9000F007C117D /* Runner.app */; - productType = "com.apple.product-type.application"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 97C146E61CF9000F007C117D /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 1020; - ORGANIZATIONNAME = "The Chromium Authors"; - TargetAttributes = { - 97C146ED1CF9000F007C117D = { - CreatedOnToolsVersion = 7.3.1; - DevelopmentTeam = 3X949YE9K2; - LastSwiftMigration = 0910; - }; - }; - }; - buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = en; - hasScannedForEncodings = 0; - knownRegions = ( - en, - Base, - ); - mainGroup = 97C146E51CF9000F007C117D; - productRefGroup = 97C146EF1CF9000F007C117D /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 97C146ED1CF9000F007C117D /* Runner */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - 97C146EC1CF9000F007C117D /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, - 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, - 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */, - 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, - 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXShellScriptBuildPhase section */ - 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "Thin Binary"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; - }; - 8B0988F04B6AE44AA0304FEF /* [CP] Embed Pods Frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "[CP] Embed Pods Frameworks"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; - showEnvVarsInLog = 0; - }; - 949FCB95217187F2C022D6A9 /* [CP] Check Pods Manifest.lock */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - ); - inputPaths = ( - "${PODS_PODFILE_DIR_PATH}/Podfile.lock", - "${PODS_ROOT}/Manifest.lock", - ); - name = "[CP] Check Pods Manifest.lock"; - outputFileListPaths = ( - ); - outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; - showEnvVarsInLog = 0; - }; - 9740EEB61CF901F6004384FC /* Run Script */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "Run Script"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; - }; -/* End PBXShellScriptBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 97C146EA1CF9000F007C117D /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, - 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXVariantGroup section */ - 97C146FA1CF9000F007C117D /* Main.storyboard */ = { - isa = PBXVariantGroup; - children = ( - 97C146FB1CF9000F007C117D /* Base */, - ); - name = Main.storyboard; - sourceTree = ""; - }; - 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { - isa = PBXVariantGroup; - children = ( - 97C147001CF9000F007C117D /* Base */, - ); - name = LaunchScreen.storyboard; - sourceTree = ""; - }; -/* End PBXVariantGroup section */ - -/* Begin XCBuildConfiguration section */ - 249021D3217E4FDB00AE95B9 /* Profile */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = iphoneos; - TARGETED_DEVICE_FAMILY = "1,2"; - VALIDATE_PRODUCT = YES; - }; - name = Profile; - }; - 249021D4217E4FDB00AE95B9 /* Profile */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CLANG_ENABLE_MODULES = YES; - CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; - DEVELOPMENT_TEAM = 3X949YE9K2; - ENABLE_BITCODE = NO; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Flutter", - ); - INFOPLIST_FILE = Runner/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 10.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - LIBRARY_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Flutter", - ); - PRODUCT_BUNDLE_IDENTIFIER = com.csdcorp.speechToTextExample; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; - SWIFT_VERSION = 5.0; - VERSIONING_SYSTEM = "apple-generic"; - }; - name = Profile; - }; - 97C147031CF9000F007C117D /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = Debug; - }; - 97C147041CF9000F007C117D /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = iphoneos; - SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - TARGETED_DEVICE_FAMILY = "1,2"; - VALIDATE_PRODUCT = YES; - }; - name = Release; - }; - 97C147061CF9000F007C117D /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CLANG_ENABLE_MODULES = YES; - CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; - DEVELOPMENT_TEAM = 3X949YE9K2; - ENABLE_BITCODE = NO; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Flutter", - ); - INFOPLIST_FILE = Runner/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 10.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - LIBRARY_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Flutter", - ); - PRODUCT_BUNDLE_IDENTIFIER = com.csdcorp.speechToTextExample; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 5.0; - VERSIONING_SYSTEM = "apple-generic"; - }; - name = Debug; - }; - 97C147071CF9000F007C117D /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CLANG_ENABLE_MODULES = YES; - CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; - DEVELOPMENT_TEAM = 3X949YE9K2; - ENABLE_BITCODE = NO; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Flutter", - ); - INFOPLIST_FILE = Runner/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 10.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - LIBRARY_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/Flutter", - ); - PRODUCT_BUNDLE_IDENTIFIER = com.csdcorp.speechToTextExample; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; - SWIFT_VERSION = 5.0; - VERSIONING_SYSTEM = "apple-generic"; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 97C147031CF9000F007C117D /* Debug */, - 97C147041CF9000F007C117D /* Release */, - 249021D3217E4FDB00AE95B9 /* Profile */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 97C147061CF9000F007C117D /* Debug */, - 97C147071CF9000F007C117D /* Release */, - 249021D4217E4FDB00AE95B9 /* Profile */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 97C146E61CF9000F007C117D /* Project object */; -} diff --git a/speech_to_text/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/speech_to_text/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 1d526a16..00000000 --- a/speech_to_text/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/speech_to_text/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/speech_to_text/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme deleted file mode 100644 index a28140cf..00000000 --- a/speech_to_text/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/speech_to_text/example/ios/Runner.xcworkspace/contents.xcworkspacedata b/speech_to_text/example/ios/Runner.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 21a3cc14..00000000 --- a/speech_to_text/example/ios/Runner.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - diff --git a/speech_to_text/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/speech_to_text/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist deleted file mode 100644 index 18d98100..00000000 --- a/speech_to_text/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +++ /dev/null @@ -1,8 +0,0 @@ - - - - - IDEDidComputeMac32BitWarning - - - diff --git a/speech_to_text/example/ios/Runner/AppDelegate.swift b/speech_to_text/example/ios/Runner/AppDelegate.swift deleted file mode 100644 index 70693e4a..00000000 --- a/speech_to_text/example/ios/Runner/AppDelegate.swift +++ /dev/null @@ -1,13 +0,0 @@ -import UIKit -import Flutter - -@UIApplicationMain -@objc class AppDelegate: FlutterAppDelegate { - override func application( - _ application: UIApplication, - didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? - ) -> Bool { - GeneratedPluginRegistrant.register(with: self) - return super.application(application, didFinishLaunchingWithOptions: launchOptions) - } -} diff --git a/speech_to_text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/speech_to_text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json deleted file mode 100644 index d36b1fab..00000000 --- a/speech_to_text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json +++ /dev/null @@ -1,122 +0,0 @@ -{ - "images" : [ - { - "size" : "20x20", - "idiom" : "iphone", - "filename" : "Icon-App-20x20@2x.png", - "scale" : "2x" - }, - { - "size" : "20x20", - "idiom" : "iphone", - "filename" : "Icon-App-20x20@3x.png", - "scale" : "3x" - }, - { - "size" : "29x29", - "idiom" : "iphone", - "filename" : "Icon-App-29x29@1x.png", - "scale" : "1x" - }, - { - "size" : "29x29", - "idiom" : "iphone", - "filename" : "Icon-App-29x29@2x.png", - "scale" : "2x" - }, - { - "size" : "29x29", - "idiom" : "iphone", - "filename" : "Icon-App-29x29@3x.png", - "scale" : "3x" - }, - { - "size" : "40x40", - "idiom" : "iphone", - "filename" : "Icon-App-40x40@2x.png", - "scale" : "2x" - }, - { - "size" : "40x40", - "idiom" : "iphone", - "filename" : "Icon-App-40x40@3x.png", - "scale" : "3x" - }, - { - "size" : "60x60", - "idiom" : "iphone", - "filename" : "Icon-App-60x60@2x.png", - "scale" : "2x" - }, - { - "size" : "60x60", - "idiom" : "iphone", - "filename" : "Icon-App-60x60@3x.png", - "scale" : "3x" - }, - { - "size" : "20x20", - "idiom" : "ipad", - "filename" : "Icon-App-20x20@1x.png", - "scale" : "1x" - }, - { - "size" : "20x20", - "idiom" : "ipad", - "filename" : "Icon-App-20x20@2x.png", - "scale" : "2x" - }, - { - "size" : "29x29", - "idiom" : "ipad", - "filename" : "Icon-App-29x29@1x.png", - "scale" : "1x" - }, - { - "size" : "29x29", - "idiom" : "ipad", - "filename" : "Icon-App-29x29@2x.png", - "scale" : "2x" - }, - { - "size" : "40x40", - "idiom" : "ipad", - "filename" : "Icon-App-40x40@1x.png", - "scale" : "1x" - }, - { - "size" : "40x40", - "idiom" : "ipad", - "filename" : "Icon-App-40x40@2x.png", - "scale" : "2x" - }, - { - "size" : "76x76", - "idiom" : "ipad", - "filename" : "Icon-App-76x76@1x.png", - "scale" : "1x" - }, - { - "size" : "76x76", - "idiom" : "ipad", - "filename" : "Icon-App-76x76@2x.png", - "scale" : "2x" - }, - { - "size" : "83.5x83.5", - "idiom" : "ipad", - "filename" : "Icon-App-83.5x83.5@2x.png", - "scale" : "2x" - }, - { - "size" : "1024x1024", - "idiom" : "ios-marketing", - "filename" : "Icon-App-1024x1024@1x.png", - "scale" : "1x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} diff --git a/speech_to_text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png b/speech_to_text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png deleted file mode 100644 index dc9ada47..00000000 Binary files a/speech_to_text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png and /dev/null differ diff --git a/speech_to_text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png b/speech_to_text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png deleted file mode 100644 index 28c6bf03..00000000 Binary files a/speech_to_text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png and /dev/null differ diff --git a/speech_to_text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png b/speech_to_text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png deleted file mode 100644 index 2ccbfd96..00000000 Binary files a/speech_to_text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png and /dev/null differ diff --git a/speech_to_text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png b/speech_to_text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png deleted file mode 100644 index f091b6b0..00000000 Binary files a/speech_to_text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png and /dev/null differ diff --git a/speech_to_text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png b/speech_to_text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png deleted file mode 100644 index 4cde1211..00000000 Binary files a/speech_to_text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png and /dev/null differ diff --git a/speech_to_text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png b/speech_to_text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png deleted file mode 100644 index d0ef06e7..00000000 Binary files a/speech_to_text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png and /dev/null differ diff --git a/speech_to_text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png b/speech_to_text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png deleted file mode 100644 index dcdc2306..00000000 Binary files a/speech_to_text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png and /dev/null differ diff --git a/speech_to_text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png b/speech_to_text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png deleted file mode 100644 index 2ccbfd96..00000000 Binary files a/speech_to_text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png and /dev/null differ diff --git a/speech_to_text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png b/speech_to_text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png deleted file mode 100644 index c8f9ed8f..00000000 Binary files a/speech_to_text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png and /dev/null differ diff --git a/speech_to_text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png b/speech_to_text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png deleted file mode 100644 index a6d6b860..00000000 Binary files a/speech_to_text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png and /dev/null differ diff --git a/speech_to_text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png b/speech_to_text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png deleted file mode 100644 index a6d6b860..00000000 Binary files a/speech_to_text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png and /dev/null differ diff --git a/speech_to_text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png b/speech_to_text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png deleted file mode 100644 index 75b2d164..00000000 Binary files a/speech_to_text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png and /dev/null differ diff --git a/speech_to_text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png b/speech_to_text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png deleted file mode 100644 index c4df70d3..00000000 Binary files a/speech_to_text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png and /dev/null differ diff --git a/speech_to_text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png b/speech_to_text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png deleted file mode 100644 index 6a84f41e..00000000 Binary files a/speech_to_text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png and /dev/null differ diff --git a/speech_to_text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png b/speech_to_text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png deleted file mode 100644 index d0e1f585..00000000 Binary files a/speech_to_text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png and /dev/null differ diff --git a/speech_to_text/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json b/speech_to_text/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json deleted file mode 100644 index 0bedcf2f..00000000 --- a/speech_to_text/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "LaunchImage.png", - "scale" : "1x" - }, - { - "idiom" : "universal", - "filename" : "LaunchImage@2x.png", - "scale" : "2x" - }, - { - "idiom" : "universal", - "filename" : "LaunchImage@3x.png", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} diff --git a/speech_to_text/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png b/speech_to_text/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png deleted file mode 100644 index 9da19eac..00000000 Binary files a/speech_to_text/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png and /dev/null differ diff --git a/speech_to_text/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png b/speech_to_text/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png deleted file mode 100644 index 9da19eac..00000000 Binary files a/speech_to_text/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png and /dev/null differ diff --git a/speech_to_text/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png b/speech_to_text/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png deleted file mode 100644 index 9da19eac..00000000 Binary files a/speech_to_text/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png and /dev/null differ diff --git a/speech_to_text/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md b/speech_to_text/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md deleted file mode 100644 index 89c2725b..00000000 --- a/speech_to_text/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# Launch Screen Assets - -You can customize the launch screen with your own desired assets by replacing the image files in this directory. - -You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. \ No newline at end of file diff --git a/speech_to_text/example/ios/Runner/Base.lproj/LaunchScreen.storyboard b/speech_to_text/example/ios/Runner/Base.lproj/LaunchScreen.storyboard deleted file mode 100644 index f2e259c7..00000000 --- a/speech_to_text/example/ios/Runner/Base.lproj/LaunchScreen.storyboard +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/speech_to_text/example/ios/Runner/Base.lproj/Main.storyboard b/speech_to_text/example/ios/Runner/Base.lproj/Main.storyboard deleted file mode 100644 index f3c28516..00000000 --- a/speech_to_text/example/ios/Runner/Base.lproj/Main.storyboard +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/speech_to_text/example/ios/Runner/Info.plist b/speech_to_text/example/ios/Runner/Info.plist deleted file mode 100644 index a69c0fce..00000000 --- a/speech_to_text/example/ios/Runner/Info.plist +++ /dev/null @@ -1,49 +0,0 @@ - - - - - NSMicrophoneUsageDescription - This example listens for speech on the device microphone on your request. - NSSpeechRecognitionUsageDescription - This example recognizes words as you speak them and displays them. - CFBundleDevelopmentRegion - $(DEVELOPMENT_LANGUAGE) - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - speech_to_text_example - CFBundlePackageType - APPL - CFBundleShortVersionString - $(FLUTTER_BUILD_NAME) - CFBundleSignature - ???? - CFBundleVersion - $(FLUTTER_BUILD_NUMBER) - LSRequiresIPhoneOS - - UILaunchStoryboardName - LaunchScreen - UIMainStoryboardFile - Main - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - UISupportedInterfaceOrientations~ipad - - UIInterfaceOrientationPortrait - UIInterfaceOrientationPortraitUpsideDown - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - UIViewControllerBasedStatusBarAppearance - - - diff --git a/speech_to_text/example/ios/Runner/Runner-Bridging-Header.h b/speech_to_text/example/ios/Runner/Runner-Bridging-Header.h deleted file mode 100644 index 7335fdf9..00000000 --- a/speech_to_text/example/ios/Runner/Runner-Bridging-Header.h +++ /dev/null @@ -1 +0,0 @@ -#import "GeneratedPluginRegistrant.h" \ No newline at end of file diff --git a/speech_to_text/example/lib/main.dart b/speech_to_text/example/lib/main.dart deleted file mode 100644 index 0115b828..00000000 --- a/speech_to_text/example/lib/main.dart +++ /dev/null @@ -1,275 +0,0 @@ -import 'dart:async'; -import 'dart:math'; - -import 'package:flutter/material.dart'; -import 'package:permission_handler/permission_handler.dart'; -import 'package:speech_to_text/speech_recognition_error.dart'; -import 'package:speech_to_text/speech_recognition_result.dart'; -import 'package:speech_to_text/speech_to_text.dart'; - -void main() => runApp(MyApp()); - -class MyApp extends StatefulWidget { - @override - _MyAppState createState() => _MyAppState(); -} - -class _MyAppState extends State { - bool _hasSpeech = false; - double level = 0.0; - double minSoundLevel = 50000; - double maxSoundLevel = -50000; - String lastWords = ""; - String lastError = ""; - String lastStatus = ""; - String _currentLocaleId = ""; - List _localeNames = []; - final SpeechToText speech = SpeechToText(); - - @override - void initState() { - requestPermissions(); - super.initState(); - } - - Future initSpeechState() async { - bool hasSpeech = await speech.initialize( - onError: errorListener, onStatus: statusListener); - if (hasSpeech) { - _localeNames = await speech.locales(); - - var systemLocale = await speech.systemLocale(); - _currentLocaleId = systemLocale.localeId; - } - - if (!mounted) return; - - setState(() { - _hasSpeech = hasSpeech; - }); - } - - void requestPermissions() async{ - Map statuses = await [ - Permission.microphone, - ].request(); - } - - @override - Widget build(BuildContext context) { - return MaterialApp( - home: Scaffold( - appBar: AppBar( - title: const Text('Speech to Text CloudSolution'), - ), - body: Column(children: [ - Center( - child: Text( - 'Speech recognition available', - style: TextStyle(fontSize: 22.0), - ), - ), - Container( - child: Column( - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - FlatButton( - child: Text('Initialize'), - onPressed: _hasSpeech ? null : initSpeechState, - ), - ], - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - FlatButton( - child: Text('Start'), - onPressed: !_hasSpeech || speech.isListening - ? null - : startListening, - ), - FlatButton( - child: Text('Stop'), - onPressed: speech.isListening ? stopListening : null, - ), - FlatButton( - child: Text('Cancel'), - onPressed: speech.isListening ? cancelListening : null, - ), - ], - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - DropdownButton( - onChanged: (selectedVal) => _switchLang(selectedVal), - value: _currentLocaleId, - items: _localeNames - .map( - (localeName) => DropdownMenuItem( - value: localeName.localeId, - child: Text(localeName.name), - ), - ) - .toList(), - ), - ], - ) - ], - ), - ), - Expanded( - flex: 4, - child: Column( - children: [ - Center( - child: Text( - 'Recognized Words', - style: TextStyle(fontSize: 22.0), - ), - ), - Expanded( - child: Stack( - children: [ - Container( - color: Theme.of(context).selectedRowColor, - child: Center( - child: Text( - lastWords, - textAlign: TextAlign.center, - ), - ), - ), - Positioned.fill( - bottom: 10, - child: Align( - alignment: Alignment.bottomCenter, - child: Container( - width: 40, - height: 40, - alignment: Alignment.center, - decoration: BoxDecoration( - boxShadow: [ - BoxShadow( - blurRadius: .26, - spreadRadius: level * 1.5, - color: Colors.black.withOpacity(.05)) - ], - color: Colors.white, - borderRadius: - BorderRadius.all(Radius.circular(50)), - ), - child: IconButton(icon: Icon(Icons.mic)), - ), - ), - ), - ], - ), - ), - ], - ), - ), - Expanded( - flex: 1, - child: Column( - children: [ - Center( - child: Text( - 'Error Status', - style: TextStyle(fontSize: 22.0), - ), - ), - Center( - child: Text(lastError), - ), - ], - ), - ), - Container( - padding: EdgeInsets.symmetric(vertical: 20), - color: Theme.of(context).backgroundColor, - child: Center( - child: speech.isListening - ? Text( - "I'm listening...", - style: TextStyle(fontWeight: FontWeight.bold), - ) - : Text( - 'Not listening', - style: TextStyle(fontWeight: FontWeight.bold), - ), - ), - ), - ]), - ), - ); - } - - void startListening() { - lastWords = ""; - lastError = ""; - speech.listen( - onResult: resultListener, - listenFor: Duration(seconds: 10), - localeId: _currentLocaleId, - onSoundLevelChange: soundLevelListener, - cancelOnError: true, - partialResults: true, - onDevice: true, - listenMode: ListenMode.confirmation); - setState(() {}); - } - - void stopListening() { - speech.stop(); - setState(() { - level = 0.0; - }); - } - - void cancelListening() { - speech.cancel(); - setState(() { - level = 0.0; - }); - } - - void resultListener(SpeechRecognitionResult result) { - setState(() { - lastWords = "${result.recognizedWords} - ${result.finalResult}"; - }); - } - - void soundLevelListener(double level) { - minSoundLevel = min(minSoundLevel, level); - maxSoundLevel = max(maxSoundLevel, level); - // print("sound level $level: $minSoundLevel - $maxSoundLevel "); - setState(() { - this.level = level; - }); - } - - void errorListener(SpeechRecognitionError error) { - // print("Received error status: $error, listening: ${speech.isListening}"); - setState(() { - lastError = "${error.errorMsg} - ${error.permanent}"; - }); - } - - void statusListener(String status) { - // print( - // "Received listener status: $status, listening: ${speech.isListening}"); - setState(() { - lastStatus = "$status"; - }); - } - - _switchLang(selectedVal) { - setState(() { - _currentLocaleId = selectedVal; - }); - print(selectedVal); - } -} diff --git a/speech_to_text/example/pubspec.lock b/speech_to_text/example/pubspec.lock deleted file mode 100644 index 6809f75f..00000000 --- a/speech_to_text/example/pubspec.lock +++ /dev/null @@ -1,203 +0,0 @@ -# Generated by pub -# See https://dart.dev/tools/pub/glossary#lockfile -packages: - async: - dependency: transitive - description: - name: async - url: "https://pub.dartlang.org" - source: hosted - version: "2.5.0-nullsafety.1" - boolean_selector: - dependency: transitive - description: - name: boolean_selector - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.0-nullsafety.1" - characters: - dependency: transitive - description: - name: characters - url: "https://pub.dartlang.org" - source: hosted - version: "1.1.0-nullsafety.3" - charcode: - dependency: transitive - description: - name: charcode - url: "https://pub.dartlang.org" - source: hosted - version: "1.2.0-nullsafety.1" - clock: - dependency: transitive - description: - name: clock - url: "https://pub.dartlang.org" - source: hosted - version: "1.1.0-nullsafety.1" - collection: - dependency: transitive - description: - name: collection - url: "https://pub.dartlang.org" - source: hosted - version: "1.15.0-nullsafety.3" - cupertino_icons: - dependency: "direct main" - description: - name: cupertino_icons - url: "https://pub.dartlang.org" - source: hosted - version: "0.1.3" - fake_async: - dependency: transitive - description: - name: fake_async - url: "https://pub.dartlang.org" - source: hosted - version: "1.2.0-nullsafety.1" - flutter: - dependency: "direct main" - description: flutter - source: sdk - version: "0.0.0" - flutter_test: - dependency: "direct dev" - description: flutter - source: sdk - version: "0.0.0" - json_annotation: - dependency: transitive - description: - name: json_annotation - url: "https://pub.dartlang.org" - source: hosted - version: "3.0.1" - matcher: - dependency: transitive - description: - name: matcher - url: "https://pub.dartlang.org" - source: hosted - version: "0.12.10-nullsafety.1" - meta: - dependency: transitive - description: - name: meta - url: "https://pub.dartlang.org" - source: hosted - version: "1.3.0-nullsafety.3" - nested: - dependency: transitive - description: - name: nested - url: "https://pub.dartlang.org" - source: hosted - version: "0.0.4" - path: - dependency: transitive - description: - name: path - url: "https://pub.dartlang.org" - source: hosted - version: "1.8.0-nullsafety.1" - permission_handler: - dependency: "direct main" - description: - name: permission_handler - url: "https://pub.dartlang.org" - source: hosted - version: "5.0.1+1" - permission_handler_platform_interface: - dependency: transitive - description: - name: permission_handler_platform_interface - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.1" - plugin_platform_interface: - dependency: transitive - description: - name: plugin_platform_interface - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.2" - provider: - dependency: "direct main" - description: - name: provider - url: "https://pub.dartlang.org" - source: hosted - version: "4.3.1" - sky_engine: - dependency: transitive - description: flutter - source: sdk - version: "0.0.99" - source_span: - dependency: transitive - description: - name: source_span - url: "https://pub.dartlang.org" - source: hosted - version: "1.8.0-nullsafety.2" - speech_to_text: - dependency: "direct dev" - description: - path: ".." - relative: true - source: path - version: "0.0.0" - stack_trace: - dependency: transitive - description: - name: stack_trace - url: "https://pub.dartlang.org" - source: hosted - version: "1.10.0-nullsafety.1" - stream_channel: - dependency: transitive - description: - name: stream_channel - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.0-nullsafety.1" - string_scanner: - dependency: transitive - description: - name: string_scanner - url: "https://pub.dartlang.org" - source: hosted - version: "1.1.0-nullsafety.1" - term_glyph: - dependency: transitive - description: - name: term_glyph - url: "https://pub.dartlang.org" - source: hosted - version: "1.2.0-nullsafety.1" - test_api: - dependency: transitive - description: - name: test_api - url: "https://pub.dartlang.org" - source: hosted - version: "0.2.19-nullsafety.2" - typed_data: - dependency: transitive - description: - name: typed_data - url: "https://pub.dartlang.org" - source: hosted - version: "1.3.0-nullsafety.3" - vector_math: - dependency: transitive - description: - name: vector_math - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.0-nullsafety.3" -sdks: - dart: ">=2.10.0-110 <2.11.0" - flutter: ">=1.16.0 <2.0.0" diff --git a/speech_to_text/example/pubspec.yaml b/speech_to_text/example/pubspec.yaml deleted file mode 100644 index d2bfcff7..00000000 --- a/speech_to_text/example/pubspec.yaml +++ /dev/null @@ -1,33 +0,0 @@ -name: speech_to_text_example -description: Demonstrates how to use the speech_to_text plugin. -version: 1.1.0 -publish_to: 'none' - -environment: - sdk: ">=2.1.0 <3.0.0" - -dependencies: - flutter: - sdk: flutter - - cupertino_icons: ^0.1.2 - permission_handler: ^5.0.1+1 - - provider: - -dev_dependencies: - flutter_test: - sdk: flutter - - speech_to_text: - path: ../ - -# The following section is specific to Flutter. -flutter: - - uses-material-design: true - - assets: - - assets/sounds/speech_to_text_listening.m4r - - assets/sounds/speech_to_text_cancel.m4r - - assets/sounds/speech_to_text_stop.m4r diff --git a/speech_to_text/example/test/widget_test.dart b/speech_to_text/example/test/widget_test.dart deleted file mode 100644 index 639a52fb..00000000 --- a/speech_to_text/example/test/widget_test.dart +++ /dev/null @@ -1,27 +0,0 @@ -// This is a basic Flutter widget test. -// -// To perform an interaction with a widget in your test, use the WidgetTester -// utility that Flutter provides. For example, you can send tap and scroll -// gestures. You can also use WidgetTester to find child widgets in the widget -// tree, read text, and verify that the values of widget properties are correct. - -import 'package:flutter/material.dart'; -import 'package:flutter_test/flutter_test.dart'; - -import '../lib/main.dart'; - -void main() { - testWidgets('Verify Platform version', (WidgetTester tester) async { - // Build our app and trigger a frame. - await tester.pumpWidget(MyApp()); - - // Verify that platform version is retrieved. - expect( - find.byWidgetPredicate( - (Widget widget) => - widget is Text && widget.data.startsWith('Running on:'), - ), - findsOneWidget, - ); - }); -} diff --git a/speech_to_text/ios/.gitignore b/speech_to_text/ios/.gitignore deleted file mode 100644 index aa479fd3..00000000 --- a/speech_to_text/ios/.gitignore +++ /dev/null @@ -1,37 +0,0 @@ -.idea/ -.vagrant/ -.sconsign.dblite -.svn/ - -.DS_Store -*.swp -profile - -DerivedData/ -build/ -GeneratedPluginRegistrant.h -GeneratedPluginRegistrant.m - -.generated/ - -*.pbxuser -*.mode1v3 -*.mode2v3 -*.perspectivev3 - -!default.pbxuser -!default.mode1v3 -!default.mode2v3 -!default.perspectivev3 - -xcuserdata - -*.moved-aside - -*.pyc -*sync/ -Icon? -.tags* - -/Flutter/Generated.xcconfig -/Flutter/flutter_export_environment.sh \ No newline at end of file diff --git a/speech_to_text/ios/Assets/.gitkeep b/speech_to_text/ios/Assets/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/speech_to_text/ios/Classes/SpeechToTextPlugin.h b/speech_to_text/ios/Classes/SpeechToTextPlugin.h deleted file mode 100644 index 1785eb8f..00000000 --- a/speech_to_text/ios/Classes/SpeechToTextPlugin.h +++ /dev/null @@ -1,4 +0,0 @@ -#import - -@interface SpeechToTextPlugin : NSObject -@end diff --git a/speech_to_text/ios/Classes/SpeechToTextPlugin.m b/speech_to_text/ios/Classes/SpeechToTextPlugin.m deleted file mode 100644 index 20d0327d..00000000 --- a/speech_to_text/ios/Classes/SpeechToTextPlugin.m +++ /dev/null @@ -1,8 +0,0 @@ -#import "SpeechToTextPlugin.h" -#import - -@implementation SpeechToTextPlugin -+ (void)registerWithRegistrar:(NSObject*)registrar { - [SwiftSpeechToTextPlugin registerWithRegistrar:registrar]; -} -@end diff --git a/speech_to_text/ios/Classes/SwiftSpeechToTextPlugin.swift b/speech_to_text/ios/Classes/SwiftSpeechToTextPlugin.swift deleted file mode 100644 index 68687967..00000000 --- a/speech_to_text/ios/Classes/SwiftSpeechToTextPlugin.swift +++ /dev/null @@ -1,580 +0,0 @@ -import Flutter -import UIKit -import Speech -import os.log -import Try - -public enum SwiftSpeechToTextMethods: String { - case has_permission - case initialize - case listen - case stop - case cancel - case locales - case unknown // just for testing -} - -public enum SwiftSpeechToTextCallbackMethods: String { - case textRecognition - case notifyStatus - case notifyError - case soundLevelChange -} - -public enum SpeechToTextStatus: String { - case listening - case notListening - case unavailable - case available -} - -public enum SpeechToTextErrors: String { - case onDeviceError - case noRecognizerError - case listenFailedError - case missingOrInvalidArg -} - -public enum ListenMode: Int { - case deviceDefault = 0 - case dictation = 1 - case search = 2 - case confirmation = 3 -} - -struct SpeechRecognitionWords : Codable { - let recognizedWords: String - let confidence: Decimal -} - -struct SpeechRecognitionResult : Codable { - let alternates: [SpeechRecognitionWords] - let finalResult: Bool -} - -struct SpeechRecognitionError : Codable { - let errorMsg: String - let permanent: Bool -} - -enum SpeechToTextError: Error { - case runtimeError(String) -} - - -@available(iOS 10.0, *) -public class SwiftSpeechToTextPlugin: NSObject, FlutterPlugin { - private var channel: FlutterMethodChannel - private var registrar: FlutterPluginRegistrar - private var recognizer: SFSpeechRecognizer? - private var currentRequest: SFSpeechAudioBufferRecognitionRequest? - private var currentTask: SFSpeechRecognitionTask? - private var listeningSound: AVAudioPlayer? - private var successSound: AVAudioPlayer? - private var cancelSound: AVAudioPlayer? - private var rememberedAudioCategory: AVAudioSession.Category? - private var previousLocale: Locale? - private var onPlayEnd: (() -> Void)? - private var returnPartialResults: Bool = true - private var failedListen: Bool = false - private var listening = false - private let audioSession = AVAudioSession.sharedInstance() - private let audioEngine = AVAudioEngine() - private let jsonEncoder = JSONEncoder() - private let busForNodeTap = 0 - private let speechBufferSize: AVAudioFrameCount = 1024 - private static var subsystem = Bundle.main.bundleIdentifier! - private let pluginLog = OSLog(subsystem: "com.csdcorp.speechToText", category: "plugin") - - public static func register(with registrar: FlutterPluginRegistrar) { - let channel = FlutterMethodChannel(name: "plugin.csdcorp.com/speech_to_text", binaryMessenger: registrar.messenger()) - let instance = SwiftSpeechToTextPlugin( channel, registrar: registrar ) - registrar.addMethodCallDelegate(instance, channel: channel ) - } - - init( _ channel: FlutterMethodChannel, registrar: FlutterPluginRegistrar ) { - self.channel = channel - self.registrar = registrar - } - - public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) { - switch call.method { - case SwiftSpeechToTextMethods.has_permission.rawValue: - hasPermission( result ) - case SwiftSpeechToTextMethods.initialize.rawValue: - initialize( result ) - case SwiftSpeechToTextMethods.listen.rawValue: - guard let argsArr = call.arguments as? Dictionary, - let partialResults = argsArr["partialResults"] as? Bool, let onDevice = argsArr["onDevice"] as? Bool, let listenModeIndex = argsArr["listenMode"] as? Int - else { - DispatchQueue.main.async { - result(FlutterError( code: SpeechToTextErrors.missingOrInvalidArg.rawValue, - message:"Missing arg partialResults, onDevice, and listenMode are required", - details: nil )) - } - return - } - var localeStr: String? = nil - if let localeParam = argsArr["localeId"] as? String { - localeStr = localeParam - } - guard let listenMode = ListenMode(rawValue: listenModeIndex) else { - DispatchQueue.main.async { - result(FlutterError( code: SpeechToTextErrors.missingOrInvalidArg.rawValue, - message:"invalid value for listenMode, must be 0-2, was \(listenModeIndex)", - details: nil )) - } - return - } - - listenForSpeech( result, localeStr: localeStr, partialResults: partialResults, onDevice: onDevice, listenMode: listenMode ) - case SwiftSpeechToTextMethods.stop.rawValue: - stopSpeech( result ) - case SwiftSpeechToTextMethods.cancel.rawValue: - cancelSpeech( result ) - case SwiftSpeechToTextMethods.locales.rawValue: - locales( result ) - default: - os_log("Unrecognized method: %{PUBLIC}@", log: pluginLog, type: .error, call.method) - DispatchQueue.main.async { - result( FlutterMethodNotImplemented) - } - } - } - - private func hasPermission( _ result: @escaping FlutterResult) { - let has = SFSpeechRecognizer.authorizationStatus() == SFSpeechRecognizerAuthorizationStatus.authorized && - AVAudioSession.sharedInstance().recordPermission == AVAudioSession.RecordPermission.granted - DispatchQueue.main.async { - result( has ) - } - } - - private func initialize( _ result: @escaping FlutterResult) { - var success = false - let status = SFSpeechRecognizer.authorizationStatus() - switch status { - case SFSpeechRecognizerAuthorizationStatus.notDetermined: - SFSpeechRecognizer.requestAuthorization({(status)->Void in - success = status == SFSpeechRecognizerAuthorizationStatus.authorized - if ( success ) { - AVAudioSession.sharedInstance().requestRecordPermission({(granted: Bool)-> Void in - if granted { - self.setupSpeechRecognition(result) - } else{ - self.sendBoolResult( false, result ); - os_log("User denied permission", log: self.pluginLog, type: .info) - } - }) - } - else { - self.sendBoolResult( false, result ); - } - }); - case SFSpeechRecognizerAuthorizationStatus.denied: - os_log("Permission permanently denied", log: self.pluginLog, type: .info) - sendBoolResult( false, result ); - case SFSpeechRecognizerAuthorizationStatus.restricted: - os_log("Device restriction prevented initialize", log: self.pluginLog, type: .info) - sendBoolResult( false, result ); - default: - os_log("Has permissions continuing with setup", log: self.pluginLog, type: .debug) - setupSpeechRecognition(result) - } - } - - fileprivate func sendBoolResult( _ value: Bool, _ result: @escaping FlutterResult) { - DispatchQueue.main.async { - result( value ) - } - } - - fileprivate func setupListeningSound() { - listeningSound = loadSound("assets/sounds/speech_to_text_listening.m4r") - successSound = loadSound("assets/sounds/speech_to_text_stop.m4r") - cancelSound = loadSound("assets/sounds/speech_to_text_cancel.m4r") - } - - fileprivate func loadSound( _ assetPath: String ) -> AVAudioPlayer? { - var player: AVAudioPlayer? = nil - let soundKey = registrar.lookupKey(forAsset: assetPath ) - guard !soundKey.isEmpty else { - return player - } - if let soundPath = Bundle.main.path(forResource: soundKey, ofType:nil) { - let soundUrl = URL(fileURLWithPath: soundPath ) - do { - player = try AVAudioPlayer(contentsOf: soundUrl ) - player?.delegate = self - } catch { - // no audio - } - } - return player - } - - private func setupSpeechRecognition( _ result: @escaping FlutterResult) { - setupRecognizerForLocale( locale: Locale.current ) - guard recognizer != nil else { - sendBoolResult( false, result ); - return - } - recognizer?.delegate = self - setupListeningSound() - - sendBoolResult( true, result ); - } - - private func setupRecognizerForLocale( locale: Locale ) { - if ( previousLocale == locale ) { - return - } - previousLocale = locale - recognizer = SFSpeechRecognizer( locale: locale ) - } - - private func getLocale( _ localeStr: String? ) -> Locale { - guard let aLocaleStr = localeStr else { - return Locale.current - } - let locale = Locale(identifier: aLocaleStr) - return locale - } - - private func stopSpeech( _ result: @escaping FlutterResult) { - if ( !listening ) { - sendBoolResult( false, result ); - return - } - stopAllPlayers() - if let sound = successSound { - onPlayEnd = {() -> Void in - self.currentTask?.finish() - self.stopCurrentListen( ) - self.sendBoolResult( true, result ) - return - } - sound.play() - } - else { - stopCurrentListen( ) - sendBoolResult( true, result ); - } - } - - private func cancelSpeech( _ result: @escaping FlutterResult) { - if ( !listening ) { - sendBoolResult( false, result ); - return - } - stopAllPlayers() - if let sound = cancelSound { - onPlayEnd = {() -> Void in - self.currentTask?.cancel() - self.stopCurrentListen( ) - self.sendBoolResult( true, result ) - return - } - sound.play() - } - else { - self.currentTask?.cancel() - stopCurrentListen( ) - sendBoolResult( true, result ); - } - } - - private func stopAllPlayers() { - cancelSound?.stop() - successSound?.stop() - listeningSound?.stop() - } - - private func stopCurrentListen( ) { - stopAllPlayers() - currentRequest?.endAudio() - - do { - try trap { - self.audioEngine.stop() - } - } - catch { - os_log("Error stopping engine: %{PUBLIC}@", log: pluginLog, type: .error, error.localizedDescription) - } - do { - try trap { - let inputNode = self.audioEngine.inputNode - inputNode.removeTap(onBus: self.busForNodeTap); - } - } - catch { - os_log("Error removing trap: %{PUBLIC}@", log: pluginLog, type: .error, error.localizedDescription) - } - do { - if let rememberedAudioCategory = rememberedAudioCategory { - try self.audioSession.setCategory(rememberedAudioCategory) - } - } - catch { - os_log("Error stopping listen: %{PUBLIC}@", log: pluginLog, type: .error, error.localizedDescription) - } - do { - try self.audioSession.setActive(false, options: .notifyOthersOnDeactivation) - } - catch { - os_log("Error deactivation: %{PUBLIC}@", log: pluginLog, type: .info, error.localizedDescription) - } - currentRequest = nil - currentTask = nil - onPlayEnd = nil - listening = false - } - - private func listenForSpeech( _ result: @escaping FlutterResult, localeStr: String?, partialResults: Bool, onDevice: Bool, listenMode: ListenMode ) { - if ( nil != currentTask || listening ) { - sendBoolResult( false, result ); - return - } - do { - // let inErrorTest = true - failedListen = false - returnPartialResults = partialResults - setupRecognizerForLocale(locale: getLocale(localeStr)) - guard let localRecognizer = recognizer else { - result(FlutterError( code: SpeechToTextErrors.noRecognizerError.rawValue, - message:"Failed to create speech recognizer", - details: nil )) - return - } - if ( onDevice ) { - if #available(iOS 13.0, *), !localRecognizer.supportsOnDeviceRecognition { - result(FlutterError( code: SpeechToTextErrors.onDeviceError.rawValue, - message:"on device recognition is not supported on this device", - details: nil )) - } - } - rememberedAudioCategory = self.audioSession.category - try self.audioSession.setCategory(AVAudioSession.Category.playAndRecord, options: .defaultToSpeaker) - // try self.audioSession.setMode(AVAudioSession.Mode.measurement) - try self.audioSession.setMode(AVAudioSession.Mode.default) - try self.audioSession.setActive(true, options: .notifyOthersOnDeactivation) - if let sound = listeningSound { - self.onPlayEnd = {()->Void in - if ( !self.failedListen ) { - self.listening = true - self.invokeFlutter( SwiftSpeechToTextCallbackMethods.notifyStatus, arguments: SpeechToTextStatus.listening.rawValue ) - - } - } - sound.play() - } - self.audioEngine.reset(); - let inputNode = self.audioEngine.inputNode - if(inputNode.inputFormat(forBus: 0).channelCount == 0){ - throw SpeechToTextError.runtimeError("Not enough available inputs.") - } - self.currentRequest = SFSpeechAudioBufferRecognitionRequest() - guard let currentRequest = self.currentRequest else { - sendBoolResult( false, result ); - return - } - currentRequest.shouldReportPartialResults = true - if #available(iOS 13.0, *), onDevice { - currentRequest.requiresOnDeviceRecognition = true - } - switch listenMode { - case ListenMode.dictation: - currentRequest.taskHint = SFSpeechRecognitionTaskHint.dictation - break - case ListenMode.search: - currentRequest.taskHint = SFSpeechRecognitionTaskHint.search - break - case ListenMode.confirmation: - currentRequest.taskHint = SFSpeechRecognitionTaskHint.confirmation - break - default: - break - } - self.currentTask = self.recognizer?.recognitionTask(with: currentRequest, delegate: self ) - let recordingFormat = inputNode.outputFormat(forBus: self.busForNodeTap) - try trap { - inputNode.installTap(onBus: self.busForNodeTap, bufferSize: self.speechBufferSize, format: recordingFormat) { (buffer: AVAudioPCMBuffer, when: AVAudioTime) in - currentRequest.append(buffer) - self.updateSoundLevel( buffer: buffer ) - } - } - // if ( inErrorTest ){ - // throw SpeechToTextError.runtimeError("for testing only") - // } - self.audioEngine.prepare() - try self.audioEngine.start() - if nil == listeningSound { - listening = true - self.invokeFlutter( SwiftSpeechToTextCallbackMethods.notifyStatus, arguments: SpeechToTextStatus.listening.rawValue ) - } - sendBoolResult( true, result ); - } - catch { - failedListen = true - os_log("Error starting listen: %{PUBLIC}@", log: pluginLog, type: .error, error.localizedDescription) - stopCurrentListen() - sendBoolResult( false, result ); - invokeFlutter( SwiftSpeechToTextCallbackMethods.notifyStatus, arguments: SpeechToTextStatus.notListening.rawValue ) - let speechError = SpeechRecognitionError(errorMsg: "error_listen_failed", permanent: true ) - do { - let errorResult = try jsonEncoder.encode(speechError) - invokeFlutter( SwiftSpeechToTextCallbackMethods.notifyError, arguments: String( data:errorResult, encoding: .utf8) ) - } catch { - os_log("Could not encode JSON", log: pluginLog, type: .error) - } - } - } - - private func updateSoundLevel( buffer: AVAudioPCMBuffer) { - guard - let channelData = buffer.floatChannelData - else { - return - } - - let channelDataValue = channelData.pointee - let channelDataValueArray = stride(from: 0, - to: Int(buffer.frameLength), - by: buffer.stride).map{ channelDataValue[$0] } - let frameLength = Float(buffer.frameLength) - let rms = sqrt(channelDataValueArray.map{ $0 * $0 }.reduce(0, +) / frameLength ) - let avgPower = 20 * log10(rms) - self.invokeFlutter( SwiftSpeechToTextCallbackMethods.soundLevelChange, arguments: avgPower ) - } - - /// Build a list of localId:name with the current locale first - private func locales( _ result: @escaping FlutterResult ) { - var localeNames = [String](); - let locales = SFSpeechRecognizer.supportedLocales(); - let currentLocale = Locale.current - if let idName = buildIdNameForLocale(forIdentifier: currentLocale.identifier ) { - localeNames.append(idName) - } - for locale in locales { - if ( locale.identifier == currentLocale.identifier) { - continue - } - if let idName = buildIdNameForLocale(forIdentifier: locale.identifier ) { - localeNames.append(idName) - } - } - DispatchQueue.main.async { - result(localeNames) - } - } - - private func buildIdNameForLocale( forIdentifier: String ) -> String? { - var idName: String? - if let name = Locale.current.localizedString(forIdentifier: forIdentifier ) { - let sanitizedName = name.replacingOccurrences(of: ":", with: " ") - idName = "\(forIdentifier):\(sanitizedName)" - } - return idName - } - - private func handleResult( _ transcriptions: [SFTranscription], isFinal: Bool ) { - if ( !isFinal && !returnPartialResults ) { - return - } - var speechWords: [SpeechRecognitionWords] = [] - for transcription in transcriptions { - let words: SpeechRecognitionWords = SpeechRecognitionWords(recognizedWords: transcription.formattedString, confidence: confidenceIn( transcription)) - speechWords.append( words ) - } - let speechInfo = SpeechRecognitionResult(alternates: speechWords, finalResult: isFinal ) - do { - let speechMsg = try jsonEncoder.encode(speechInfo) - if let speechStr = String( data:speechMsg, encoding: .utf8) { - os_log("Encoded JSON result: %{PUBLIC}@", log: pluginLog, type: .debug, speechStr ) - invokeFlutter( SwiftSpeechToTextCallbackMethods.textRecognition, arguments: speechStr ) - } - } catch { - os_log("Could not encode JSON", log: pluginLog, type: .error) - } - } - - private func confidenceIn( _ transcription: SFTranscription ) -> Decimal { - guard ( transcription.segments.count > 0 ) else { - return 0; - } - var totalConfidence: Float = 0.0; - for segment in transcription.segments { - totalConfidence += segment.confidence - } - let avgConfidence: Float = totalConfidence / Float(transcription.segments.count ) - let confidence: Float = (avgConfidence * 1000).rounded() / 1000 - return Decimal( string: String( describing: confidence ) )! - } - - private func invokeFlutter( _ method: SwiftSpeechToTextCallbackMethods, arguments: Any? ) { - DispatchQueue.main.async { - self.channel.invokeMethod( method.rawValue, arguments: arguments ) - } - } - -} - -@available(iOS 10.0, *) -extension SwiftSpeechToTextPlugin : SFSpeechRecognizerDelegate { - public func speechRecognizer(_ speechRecognizer: SFSpeechRecognizer, availabilityDidChange available: Bool) { - let availability = available ? SpeechToTextStatus.available.rawValue : SpeechToTextStatus.unavailable.rawValue - os_log("Availability changed: %{PUBLIC}@", log: pluginLog, type: .debug, availability) - invokeFlutter( SwiftSpeechToTextCallbackMethods.notifyStatus, arguments: availability ) - } -} - -@available(iOS 10.0, *) -extension SwiftSpeechToTextPlugin : SFSpeechRecognitionTaskDelegate { - public func speechRecognitionDidDetectSpeech(_ task: SFSpeechRecognitionTask) { - // Do nothing for now - } - - public func speechRecognitionTaskFinishedReadingAudio(_ task: SFSpeechRecognitionTask) { - reportError(source: "FinishedReadingAudio", error: task.error) - invokeFlutter( SwiftSpeechToTextCallbackMethods.notifyStatus, arguments: SpeechToTextStatus.notListening.rawValue ) - } - - public func speechRecognitionTaskWasCancelled(_ task: SFSpeechRecognitionTask) { - reportError(source: "TaskWasCancelled", error: task.error) - invokeFlutter( SwiftSpeechToTextCallbackMethods.notifyStatus, arguments: SpeechToTextStatus.notListening.rawValue ) - } - - public func speechRecognitionTask(_ task: SFSpeechRecognitionTask, didFinishSuccessfully successfully: Bool) { - reportError(source: "FinishSuccessfully", error: task.error) - stopCurrentListen( ) - } - - public func speechRecognitionTask(_ task: SFSpeechRecognitionTask, didHypothesizeTranscription transcription: SFTranscription) { - reportError(source: "HypothesizeTranscription", error: task.error) - handleResult( [transcription], isFinal: false ) - } - - public func speechRecognitionTask(_ task: SFSpeechRecognitionTask, didFinishRecognition recognitionResult: SFSpeechRecognitionResult) { - reportError(source: "FinishRecognition", error: task.error) - let isFinal = recognitionResult.isFinal - handleResult( recognitionResult.transcriptions, isFinal: isFinal ) - } - - private func reportError( source: String, error: Error?) { - if ( nil != error) { - os_log("%{PUBLIC}@ with error: %{PUBLIC}@", log: pluginLog, type: .debug, source, error.debugDescription) - } - } -} - -@available(iOS 10.0, *) -extension SwiftSpeechToTextPlugin : AVAudioPlayerDelegate { - - public func audioPlayerDidFinishPlaying(_ player: AVAudioPlayer, - successfully flag: Bool) { - if let playEnd = self.onPlayEnd { - playEnd() - } - } -} diff --git a/speech_to_text/ios/speech_to_text.podspec b/speech_to_text/ios/speech_to_text.podspec deleted file mode 100644 index 1db79aa0..00000000 --- a/speech_to_text/ios/speech_to_text.podspec +++ /dev/null @@ -1,22 +0,0 @@ -# -# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html -# -Pod::Spec.new do |s| - s.name = 'speech_to_text' - s.version = '0.0.1' - s.summary = 'A new flutter plugin project.' - s.description = <<-DESC -A new flutter plugin project. - DESC - s.homepage = 'http://example.com' - s.license = { :file => '../LICENSE' } - s.author = { 'Your Company' => 'email@example.com' } - s.source = { :path => '.' } - s.source_files = 'Classes/**/*' - s.public_header_files = 'Classes/**/*.h' - s.dependency 'Flutter' - s.dependency 'Try' - - s.ios.deployment_target = '8.0' -end - diff --git a/speech_to_text/lib/speech_recognition_error.dart b/speech_to_text/lib/speech_recognition_error.dart deleted file mode 100644 index 2ab6cd4d..00000000 --- a/speech_to_text/lib/speech_recognition_error.dart +++ /dev/null @@ -1,44 +0,0 @@ -import 'package:json_annotation/json_annotation.dart'; - -part 'speech_recognition_error.g.dart'; - -/// A single error returned from the underlying speech services. -/// -/// Errors are either transient or permanent. Permanent errors -/// block speech recognition from continuing and must be -/// addressed before recogntion will work. Transient errors -/// cause individual recognition sessions to fail but subsequent -/// attempts may well succeed. -@JsonSerializable() -class SpeechRecognitionError { - /// Use this to differentiate the various error conditions. - /// - /// Not meant for display to the user. - final String errorMsg; - - /// True means that recognition cannot continue until - /// the error is resolved. - final bool permanent; - - SpeechRecognitionError(this.errorMsg, this.permanent); - - factory SpeechRecognitionError.fromJson(Map json) => - _$SpeechRecognitionErrorFromJson(json); - Map toJson() => _$SpeechRecognitionErrorToJson(this); - - @override - String toString() { - return "SpeechRecognitionError msg: $errorMsg, permanent: $permanent"; - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - other is SpeechRecognitionError && - errorMsg == other.errorMsg && - permanent == other.permanent; - } - - @override - int get hashCode => errorMsg.hashCode; -} diff --git a/speech_to_text/lib/speech_recognition_error.g.dart b/speech_to_text/lib/speech_recognition_error.g.dart deleted file mode 100644 index 65299f6d..00000000 --- a/speech_to_text/lib/speech_recognition_error.g.dart +++ /dev/null @@ -1,22 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'speech_recognition_error.dart'; - -// ************************************************************************** -// JsonSerializableGenerator -// ************************************************************************** - -SpeechRecognitionError _$SpeechRecognitionErrorFromJson( - Map json) { - return SpeechRecognitionError( - json['errorMsg'] as String, - json['permanent'] as bool, - ); -} - -Map _$SpeechRecognitionErrorToJson( - SpeechRecognitionError instance) => - { - 'errorMsg': instance.errorMsg, - 'permanent': instance.permanent, - }; diff --git a/speech_to_text/lib/speech_recognition_event.dart b/speech_to_text/lib/speech_recognition_event.dart deleted file mode 100644 index 71729365..00000000 --- a/speech_to_text/lib/speech_recognition_event.dart +++ /dev/null @@ -1,30 +0,0 @@ -import 'package:speech_to_text/speech_recognition_error.dart'; -import 'package:speech_to_text/speech_recognition_result.dart'; - -enum SpeechRecognitionEventType { - finalRecognitionEvent, - partialRecognitionEvent, - errorEvent, - statusChangeEvent, - soundLevelChangeEvent, -} - -/// A single event in a stream of speech recognition events. -/// -/// Use [eventType] to determine what type of event it is and depending on that -/// use the other properties to get information about it. -class SpeechRecognitionEvent { - final SpeechRecognitionEventType eventType; - final SpeechRecognitionError _error; - final SpeechRecognitionResult _result; - final bool _listening; - final double _level; - - SpeechRecognitionEvent( - this.eventType, this._result, this._error, this._listening, this._level); - - bool get isListening => _listening; - double get level => _level; - SpeechRecognitionResult get recognitionResult => _result; - SpeechRecognitionError get error => _error; -} diff --git a/speech_to_text/lib/speech_recognition_result.dart b/speech_to_text/lib/speech_recognition_result.dart deleted file mode 100644 index 38509f65..00000000 --- a/speech_to_text/lib/speech_recognition_result.dart +++ /dev/null @@ -1,140 +0,0 @@ -import 'dart:collection'; - -import 'package:json_annotation/json_annotation.dart'; - -part 'speech_recognition_result.g.dart'; - -/// A sequence of recognized words from the speech recognition -/// service. -/// -/// Depending on the platform behaviour the words may come in all -/// at once at the end or as partial results as each word is -/// recognized. Use the [finalResult] flag to determine if the -/// result is considered final by the platform. -@JsonSerializable(explicitToJson: true) -class SpeechRecognitionResult { - List _alternates; - - /// Returns a list of possible transcriptions of the speech. - /// - /// The first value is always the same as the [recognizedWords] - /// value. Use the confidence for each alternate transcription - /// to determine how likely it is. Note that not all platforms - /// do a good job with confidence, there are convenience methods - /// on [SpeechRecogntionWords] to work with possibly missing - /// confidence values. - List get alternates => - UnmodifiableListView(_alternates); - - /// The sequence of words that is the best transcription of - /// what was said. - /// - /// This is the same as the first value of [alternates]. - String get recognizedWords => - _alternates.isNotEmpty ? _alternates.first.recognizedWords : ""; - - /// False means the words are an interim result, true means - /// they are the final recognition. - final bool finalResult; - - /// The confidence that the [recognizedWords] are correct. - /// - /// Confidence is expressed as a value between 0 and 1. -1 - /// means that the confidence value was not available. - double get confidence => - _alternates.isNotEmpty ? _alternates.first.confidence : 0; - - /// true if there is confidence in this recognition, false otherwise. - /// - /// There are two separate ways for there to be confidence, the first - /// is if the confidence is missing, which is indicated by a value of - /// -1. The second is if the confidence is greater than or equal - /// [threshold]. If [threshold] is not provided it defaults to 0.8. - bool isConfident( - {double threshold = SpeechRecognitionWords.confidenceThreshold}) => - _alternates.isNotEmpty - ? _alternates.first.isConfident(threshold: threshold) - : false; - - /// true if [confidence] is not the [missingConfidence] value, false - /// otherwise. - bool get hasConfidenceRating => - _alternates.isNotEmpty ? _alternates.first.hasConfidenceRating : false; - - SpeechRecognitionResult(this._alternates, this.finalResult); - - @override - String toString() { - return "SpeechRecognitionResult words: $_alternates, final: $finalResult"; - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - other is SpeechRecognitionResult && - recognizedWords == other.recognizedWords && - finalResult == other.finalResult; - } - - @override - int get hashCode => recognizedWords.hashCode; - - factory SpeechRecognitionResult.fromJson(Map json) => - _$SpeechRecognitionResultFromJson(json); - Map toJson() => _$SpeechRecognitionResultToJson(this); -} - -/// A set of words recognized in a [SpeechRecognitionResult]. -/// -/// Each result will have one or more [SpeechRecognitionWords] -/// with a varying degree of confidence about each set of words. -@JsonSerializable() -class SpeechRecognitionWords { - /// The sequence of words recognized - final String recognizedWords; - - /// The confidence that the [recognizedWords] are correct. - /// - /// Confidence is expressed as a value between 0 and 1. 0 - /// means that the confidence value was not available. Use - /// [isConfident] which will ignore 0 values automatically. - final double confidence; - - static const double confidenceThreshold = 0.8; - static const double missingConfidence = -1; - - const SpeechRecognitionWords(this.recognizedWords, this.confidence); - - /// true if there is confidence in this recognition, false otherwise. - /// - /// There are two separate ways for there to be confidence, the first - /// is if the confidence is missing, which is indicated by a value of - /// -1. The second is if the confidence is greater than or equal - /// [threshold]. If [threshold] is not provided it defaults to 0.8. - bool isConfident({double threshold = confidenceThreshold}) => - confidence == missingConfidence || confidence >= threshold; - - /// true if [confidence] is not the [missingConfidence] value, false - /// otherwise. - bool get hasConfidenceRating => confidence != missingConfidence; - - @override - String toString() { - return "SpeechRecognitionWords words: $recognizedWords, confidence: $confidence"; - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - other is SpeechRecognitionWords && - recognizedWords == other.recognizedWords && - confidence == other.confidence; - } - - @override - int get hashCode => recognizedWords.hashCode; - - factory SpeechRecognitionWords.fromJson(Map json) => - _$SpeechRecognitionWordsFromJson(json); - Map toJson() => _$SpeechRecognitionWordsToJson(this); -} diff --git a/speech_to_text/lib/speech_recognition_result.g.dart b/speech_to_text/lib/speech_recognition_result.g.dart deleted file mode 100644 index 023e5485..00000000 --- a/speech_to_text/lib/speech_recognition_result.g.dart +++ /dev/null @@ -1,41 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'speech_recognition_result.dart'; - -// ************************************************************************** -// JsonSerializableGenerator -// ************************************************************************** - -SpeechRecognitionResult _$SpeechRecognitionResultFromJson( - Map json) { - return SpeechRecognitionResult( - (json['alternates'] as List) - ?.map((e) => e == null - ? null - : SpeechRecognitionWords.fromJson(e as Map)) - ?.toList(), - json['finalResult'] as bool, - ); -} - -Map _$SpeechRecognitionResultToJson( - SpeechRecognitionResult instance) => - { - 'alternates': instance.alternates?.map((e) => e?.toJson())?.toList(), - 'finalResult': instance.finalResult, - }; - -SpeechRecognitionWords _$SpeechRecognitionWordsFromJson( - Map json) { - return SpeechRecognitionWords( - json['recognizedWords'] as String, - (json['confidence'] as num)?.toDouble(), - ); -} - -Map _$SpeechRecognitionWordsToJson( - SpeechRecognitionWords instance) => - { - 'recognizedWords': instance.recognizedWords, - 'confidence': instance.confidence, - }; diff --git a/speech_to_text/lib/speech_to_text.dart b/speech_to_text/lib/speech_to_text.dart deleted file mode 100644 index 343706e6..00000000 --- a/speech_to_text/lib/speech_to_text.dart +++ /dev/null @@ -1,511 +0,0 @@ -import 'dart:async'; -import 'dart:convert'; -import 'dart:math'; - -import 'package:clock/clock.dart'; -import 'package:flutter/foundation.dart'; -import 'package:flutter/services.dart'; -import 'package:speech_to_text/speech_recognition_error.dart'; -import 'package:speech_to_text/speech_recognition_result.dart'; - -enum ListenMode { - deviceDefault, - dictation, - search, - confirmation, -} - -/// Notified as words are recognized with the current set of recognized words. -/// -/// See the [onResult] argument on the [listen] method for use. -typedef SpeechResultListener = void Function(SpeechRecognitionResult result); - -/// Notified if errors occur during recognition or intialization. -/// -/// Possible errors per the Android docs are described here: -/// https://developer.android.com/reference/android/speech/SpeechRecognizer -/// "error_audio_error" -/// "error_client" -/// "error_permission" -/// "error_network" -/// "error_network_timeout" -/// "error_no_match" -/// "error_busy" -/// "error_server" -/// "error_speech_timeout" -/// See the [onError] argument on the [initialize] method for use. -typedef SpeechErrorListener = void Function( - SpeechRecognitionError errorNotification); - -/// Notified when recognition status changes. -/// -/// See the [onStatus] argument on the [initialize] method for use. -typedef SpeechStatusListener = void Function(String status); - -/// Notified when the sound level changes during a listen method. -/// -/// [level] is a measure of the decibels of the current sound on -/// the recognition input. See the [onSoundLevelChange] argument on -/// the [listen] method for use. -typedef SpeechSoundLevelChange = Function(double level); - -/// An interface to device specific speech recognition services. -/// -/// The general flow of a speech recognition session is as follows: -/// ```Dart -/// SpeechToText speech = SpeechToText(); -/// bool isReady = await speech.initialize(); -/// if ( isReady ) { -/// await speech.listen( resultListener: resultListener ); -/// } -/// ... -/// // At some point later -/// speech.stop(); -/// ``` -class SpeechToText { - static const String listenMethod = 'listen'; - static const String textRecognitionMethod = 'textRecognition'; - static const String notifyErrorMethod = 'notifyError'; - static const String notifyStatusMethod = 'notifyStatus'; - static const String soundLevelChangeMethod = "soundLevelChange"; - static const String notListeningStatus = "notListening"; - static const String listeningStatus = "listening"; - - static const MethodChannel speechChannel = - const MethodChannel('plugin.csdcorp.com/speech_to_text'); - static final SpeechToText _instance = - SpeechToText.withMethodChannel(speechChannel); - bool _initWorked = false; - bool _recognized = false; - bool _listening = false; - bool _cancelOnError = false; - bool _partialResults = false; - int _listenStartedAt = 0; - int _lastSpeechEventAt = 0; - Duration _pauseFor; - Duration _listenFor; - - /// True if not listening or the user called cancel / stop, false - /// if cancel/stop were invoked by timeout or error condition. - bool _userEnded = false; - String _lastRecognized = ""; - String _lastStatus = ""; - double _lastSoundLevel = 0; - Timer _listenTimer; - LocaleName _systemLocale; - SpeechRecognitionError _lastError; - SpeechResultListener _resultListener; - SpeechErrorListener errorListener; - SpeechStatusListener statusListener; - SpeechSoundLevelChange _soundLevelChange; - - final MethodChannel channel; - factory SpeechToText() => _instance; - - @visibleForTesting - SpeechToText.withMethodChannel(this.channel); - - /// True if words have been recognized during the current [listen] call. - /// - /// Goes false as soon as [cancel] is called. - bool get hasRecognized => _recognized; - - /// The last set of recognized words received. - /// - /// This is maintained across [cancel] calls but cleared on the next - /// [listen]. - String get lastRecognizedWords => _lastRecognized; - - /// The last status update received, see [initialize] to register - /// an optional listener to be notified when this changes. - String get lastStatus => _lastStatus; - - /// The last sound level received during a listen event. - /// - /// The sound level is a measure of how loud the current - /// input is during listening. Use the [onSoundLevelChange] - /// argument in the [listen] method to get notified of - /// changes. - double get lastSoundLevel => _lastSoundLevel; - - /// True if [initialize] succeeded - bool get isAvailable => _initWorked; - - /// True if [listen] succeeded and [stop] or [cancel] has not been called. - /// - /// Also goes false when listening times out if listenFor was set. - bool get isListening => _listening; - bool get isNotListening => !isListening; - - /// The last error received or null if none, see [initialize] to - /// register an optional listener to be notified of errors. - SpeechRecognitionError get lastError => _lastError; - - /// True if an error has been received, see [lastError] for details - bool get hasError => null != lastError; - - /// Returns true if the user has already granted permission to access the - /// microphone, does not prompt the user. - /// - /// This method can be called before [initialize] to check if permission - /// has already been granted. If this returns false then the [initialize] - /// call will prompt the user for permission if it is allowed to do so. - /// Note that applications cannot ask for permission again if the user has - /// denied them permission in the past. - Future get hasPermission async { - bool hasPermission = await channel.invokeMethod('has_permission'); - return hasPermission; - } - - /// Initialize speech recognition services, returns true if - /// successful, false if failed. - /// - /// This method must be called before any other speech functions. - /// If this method returns false no further [SpeechToText] methods - /// should be used. Should only be called once if successful but does protect - /// itself if called repeatedly. False usually means that the user has denied - /// permission to use speech. The usual option in that case is to give them - /// instructions on how to open system settings and grant permission. - /// - /// [onError] is an optional listener for errors like - /// timeout, or failure of the device speech recognition. - /// [onStatus] is an optional listener for status changes from - /// listening to not listening. - /// [debugLogging] controls whether there is detailed logging from the underlying - /// plugins. It is off by default, usually only useful for troubleshooting issues - /// with a paritcular OS version or device, fairly verbose - Future initialize( - {SpeechErrorListener onError, - SpeechStatusListener onStatus, - debugLogging = false}) async { - if (_initWorked) { - return Future.value(_initWorked); - } - errorListener = onError; - statusListener = onStatus; - channel.setMethodCallHandler(_handleCallbacks); - _initWorked = await channel - .invokeMethod('initialize', {"debugLogging": debugLogging}); - return _initWorked; - } - - /// Stops the current listen for speech if active, does nothing if not. - /// - /// Stopping a listen session will cause a final result to be sent. Each - /// listen session should be ended with either [stop] or [cancel], for - /// example in the dispose method of a Widget. [cancel] is automatically - /// invoked by a permanent error if [cancelOnError] is set to true in the - /// [listen] call. - /// - /// *Note:* Cannot be used until a successful [initialize] call. Should - /// only be used after a successful [listen] call. - Future stop() async { - _userEnded = true; - return _stop(); - } - - Future _stop() async { - if (!_initWorked) { - return; - } - _shutdownListener(); - await channel.invokeMethod('stop'); - } - - /// Cancels the current listen for speech if active, does nothing if not. - /// - /// Canceling means that there will be no final result returned from the - /// recognizer. Each listen session should be ended with either [stop] or - /// [cancel], for example in the dispose method of a Widget. [cancel] is - /// automatically invoked by a permanent error if [cancelOnError] is set - /// to true in the [listen] call. - /// - /// *Note* Cannot be used until a successful [initialize] call. Should only - /// be used after a successful [listen] call. - Future cancel() async { - _userEnded = true; - return _cancel(); - } - - Future _cancel() async { - if (!_initWorked) { - return; - } - _shutdownListener(); - await channel.invokeMethod('cancel'); - } - - /// Starts a listening session for speech and converts it to text, - /// invoking the provided [onResult] method as words are recognized. - /// - /// Cannot be used until a successful [initialize] call. There is a - /// time limit on listening imposed by both Android and iOS. The time - /// depends on the device, network, etc. Android is usually quite short, - /// especially if there is no active speech event detected, on the order - /// of ten seconds or so. - /// - /// When listening is done always invoke either [cancel] or [stop] to - /// end the session, even if it times out. [cancelOnError] provides an - /// automatic way to ensure this happens. - /// - /// [onResult] is an optional listener that is notified when words - /// are recognized. - /// - /// [listenFor] sets the maximum duration that it will listen for, after - /// that it automatically stops the listen for you. - /// - /// [pauseFor] sets the maximum duration of a pause in speech with no words - /// detected, after that it automatically stops the listen for you. - /// - /// [localeId] is an optional locale that can be used to listen in a language - /// other than the current system default. See [locales] to find the list of - /// supported languages for listening. - /// - /// [onSoundLevelChange] is an optional listener that is notified when the - /// sound level of the input changes. Use this to update the UI in response to - /// more or less input. The values currently differ between Ancroid and iOS, - /// haven't yet been able to determine from the Android documentation what the - /// value means. On iOS the value returned is in decibels. - /// - /// [cancelOnError] if true then listening is automatically canceled on a - /// permanent error. This defaults to false. When false cancel should be - /// called from the error handler. - /// - /// [partialResults] if true the listen reports results as they are recognized, - /// when false only final results are reported. Defaults to true. - /// - /// [onDevice] if true the listen attempts to recognize locally with speech never - /// leaving the device. If it cannot do this the listen attempt will fail. This is - /// usually only needed for sensitive content where privacy or security is a concern. - Future listen( - {SpeechResultListener onResult, - Duration listenFor, - Duration pauseFor, - String localeId, - SpeechSoundLevelChange onSoundLevelChange, - cancelOnError = false, - partialResults = true, - onDevice = false, - ListenMode listenMode = ListenMode.confirmation}) async { - if (!_initWorked) { - throw SpeechToTextNotInitializedException(); - } - _userEnded = false; - _cancelOnError = cancelOnError; - _recognized = false; - _resultListener = onResult; - _soundLevelChange = onSoundLevelChange; - _partialResults = partialResults; - Map listenParams = { - "partialResults": partialResults || null != pauseFor, - "onDevice": onDevice, - "listenMode": listenMode.index, - }; - if (null != localeId) { - listenParams["localeId"] = localeId; - } - try { - bool started = await channel.invokeMethod(listenMethod, listenParams); - if (started) { - _listenStartedAt = clock.now().millisecondsSinceEpoch; - _setupListenAndPause(pauseFor, listenFor); - } - } on PlatformException catch (e) { - throw ListenFailedException(e.details); - } - } - - void _setupListenAndPause(Duration pauseFor, Duration listenFor) { - _pauseFor = null; - _listenFor = null; - if (null == pauseFor && null == listenFor) { - return; - } - var minDuration; - if (null == pauseFor) { - _listenFor = Duration(milliseconds: listenFor.inMilliseconds); - minDuration = listenFor; - } else if (null == listenFor) { - _pauseFor = Duration(milliseconds: pauseFor.inMilliseconds); - minDuration = pauseFor; - } else { - _listenFor = Duration(milliseconds: listenFor.inMilliseconds); - _pauseFor = Duration(milliseconds: pauseFor.inMilliseconds); - var minMillis = min(listenFor.inMilliseconds - _elapsedListenMillis, - pauseFor.inMilliseconds); - minDuration = Duration(milliseconds: minMillis); - } - _listenTimer = Timer(minDuration, _stopOnPauseOrListen); - } - - int get _elapsedListenMillis => - clock.now().millisecondsSinceEpoch - _listenStartedAt; - int get _elapsedSinceSpeechEvent => - clock.now().millisecondsSinceEpoch - _lastSpeechEventAt; - - void _stopOnPauseOrListen() { - if (null != _listenFor && - _elapsedListenMillis >= _listenFor.inMilliseconds) { - _stop(); - } else if (null != _pauseFor && - _elapsedSinceSpeechEvent >= _pauseFor.inMilliseconds) { - _stop(); - } else { - _setupListenAndPause(_pauseFor, _listenFor); - } - } - - /// returns the list of speech locales available on the device. - /// - /// This method is useful to find the identifier to use - /// for the [listen] method, it is the [localeId] member of the - /// [LocaleName]. - /// - /// Each [LocaleName] in the returned list has the - /// identifier for the locale as well as a name for - /// display. The name is localized for the system locale on - /// the device. - Future> locales() async { - if (!_initWorked) { - throw SpeechToTextNotInitializedException(); - } - final List locales = await channel.invokeMethod('locales'); - List filteredLocales = locales - .map((locale) { - var components = locale.split(":"); - if (components.length != 2) { - return null; - } - return LocaleName(components[0], components[1]); - }) - .where((item) => item != null) - .toList(); - if (filteredLocales.isNotEmpty) { - _systemLocale = filteredLocales.first; - } else { - _systemLocale = null; - } - filteredLocales.sort((ln1, ln2) => ln1.name.compareTo(ln2.name)); - return filteredLocales; - } - - /// returns the locale that will be used if no localeId is passed - /// to the [listen] method. - Future systemLocale() async { - if (null == _systemLocale) { - await locales(); - } - return Future.value(_systemLocale); - } - - Future _handleCallbacks(MethodCall call) async { - // print("SpeechToText call: ${call.method} ${call.arguments}"); - switch (call.method) { - case textRecognitionMethod: - if (call.arguments is String) { - _onTextRecognition(call.arguments); - } - break; - case notifyErrorMethod: - if (call.arguments is String) { - await _onNotifyError(call.arguments); - } - break; - case notifyStatusMethod: - if (call.arguments is String) { - _onNotifyStatus(call.arguments); - } - break; - case soundLevelChangeMethod: - if (call.arguments is double) { - _onSoundLevelChange(call.arguments); - } - break; - default: - } - } - - void _onTextRecognition(String resultJson) { - _lastSpeechEventAt = clock.now().millisecondsSinceEpoch; - Map resultMap = jsonDecode(resultJson); - SpeechRecognitionResult speechResult = - SpeechRecognitionResult.fromJson(resultMap); - if (!_partialResults && !speechResult.finalResult) { - return; - } - _recognized = true; - // print("Recognized text $resultJson"); - - _lastRecognized = speechResult.recognizedWords; - if (null != _resultListener) { - _resultListener(speechResult); - } - } - - Future _onNotifyError(String errorJson) async { - if (isNotListening && _userEnded) { - return; - } - Map errorMap = jsonDecode(errorJson); - SpeechRecognitionError speechError = - SpeechRecognitionError.fromJson(errorMap); - _lastError = speechError; - if (null != errorListener) { - errorListener(speechError); - } - if (_cancelOnError && speechError.permanent) { - await _cancel(); - } - } - - void _onNotifyStatus(String status) { - _lastStatus = status; - _listening = status == listeningStatus; - // print(status); - if (null != statusListener) { - statusListener(status); - } - } - - void _onSoundLevelChange(double level) { - if (isNotListening) { - return; - } - _lastSoundLevel = level; - if (null != _soundLevelChange) { - _soundLevelChange(level); - } - } - - _shutdownListener() { - _listening = false; - _recognized = false; - _listenTimer?.cancel(); - _listenTimer = null; - } - - @visibleForTesting - Future processMethodCall(MethodCall call) async { - return await _handleCallbacks(call); - } -} - -/// A single locale with a [name], localized to the current system locale, -/// and a [localeId] which can be used in the [listen] method to choose a -/// locale for speech recognition. -class LocaleName { - final String localeId; - final String name; - LocaleName(this.localeId, this.name); -} - -/// Thrown when a method is called that requires successful -/// initialization first. -class SpeechToTextNotInitializedException implements Exception {} - -/// Thrown when listen fails to properly start a speech listening session -/// on the device -class ListenFailedException implements Exception { - final String details; - ListenFailedException(this.details); -} diff --git a/speech_to_text/lib/speech_to_text_provider.dart b/speech_to_text/lib/speech_to_text_provider.dart deleted file mode 100644 index 91adf3b4..00000000 --- a/speech_to_text/lib/speech_to_text_provider.dart +++ /dev/null @@ -1,201 +0,0 @@ -import 'dart:async'; - -import 'package:flutter/material.dart'; -import 'package:speech_to_text/speech_recognition_error.dart'; -import 'package:speech_to_text/speech_recognition_event.dart'; -import 'package:speech_to_text/speech_recognition_result.dart'; -import 'package:speech_to_text/speech_to_text.dart'; - -/// Simplifies interaction with [SpeechToText] by handling all the callbacks and notifying -/// listeners as events happen. -/// -/// Here's an example of using the [SpeechToTextProvider] -/// ``` -/// var speechProvider = SpeechToTextProvider( SpeechToText()); -/// var available = await speechProvider.initialize(); -/// StreamSubscription _subscription; -/// _subscription = speechProvider.recognitionController.stream.listen((recognitionEvent) { -/// if (recognitionEvent.eventType == SpeechRecognitionEventType.finalRecognitionEvent ) { -/// print("I heard: ${recognitionEvent.recognitionResult.recognizedWords}"); -/// } -/// }); -/// speechProvider.addListener(() { -/// var words = speechProvider.lastWords; -/// }); -class SpeechToTextProvider extends ChangeNotifier { - final StreamController _recognitionController = - StreamController.broadcast(); - final SpeechToText _speechToText; - SpeechRecognitionResult _lastResult; - double _lastLevel = 0; - List _locales = []; - LocaleName _systemLocale; - - /// Only construct one instance in an application. - /// - /// Do not call `initialize` on the [SpeechToText] that is passed as a parameter, instead - /// call the [initialize] method on this class. - SpeechToTextProvider(this._speechToText); - - Stream get stream => _recognitionController.stream; - - /// Returns the last result received, may be null. - SpeechRecognitionResult get lastResult => _lastResult; - - /// Returns the last error received, may be null. - SpeechRecognitionError get lastError => _speechToText.lastError; - - /// Returns the last sound level received. - /// - /// Note this is only available when the `soundLevel` is set to true on - /// a call to [listen], will be 0 at all other times. - double get lastLevel => _lastLevel; - - /// Initializes the provider and the contained [SpeechToText] instance. - /// - /// Returns true if [SpeechToText] was initialized successful and can now - /// be used, false otherwse. - Future initialize() async { - if (isAvailable) { - return isAvailable; - } - bool availableBefore = _speechToText.isAvailable; - bool available = - await _speechToText.initialize(onStatus: _onStatus, onError: _onError); - if (available) { - _locales = []; - _locales.addAll(await _speechToText.locales()); - _systemLocale = await _speechToText.systemLocale(); - } - if (availableBefore != available) { - notifyListeners(); - } - return available; - } - - /// Returns true if the provider has been initialized and can be used to recognize speech. - bool get isAvailable => _speechToText.isAvailable; - - /// Returns true if the provider cannot be used to recognize speech, either because it has not - /// yet been initialized or because initialization failed. - bool get isNotAvailable => !_speechToText.isAvailable; - - /// Returns true if [SpeechToText] is listening for new speech. - bool get isListening => _speechToText.isListening; - - /// Returns true if [SpeechToText] is not listening for new speech. - bool get isNotListening => _speechToText.isNotListening; - - /// Returns true if [SpeechToText] has a previous error. - bool get hasError => _speechToText.hasError; - - /// Returns true if [lastResult] has a last result. - bool get hasResults => null != _lastResult; - - /// Returns the list of locales that are available on the device for speech recognition. - List get locales => _locales; - - /// Returns the locale that is currently set as active on the device. - LocaleName get systemLocale => _systemLocale; - - /// Start listening for new events, set [partialResults] to true to receive interim - /// recognition results. - /// - /// [soundLevel] set to true to be notified on changes to the input sound level - /// on the microphone. - /// - /// [listenFor] sets the maximum duration that it will listen for, after - /// that it automatically stops the listen for you. - /// - /// [pauseFor] sets the maximum duration of a pause in speech with no words - /// detected, after that it automatically stops the listen for you. - /// - /// Call this only after a successful [initialize] call - void listen( - {bool partialResults = false, - bool soundLevel = false, - Duration listenFor, - Duration pauseFor}) { - _lastLevel = 0; - _lastResult = null; - if (soundLevel) { - _speechToText.listen( - partialResults: partialResults, - listenFor: listenFor, - pauseFor: pauseFor, - cancelOnError: true, - onResult: _onListenResult, - // onSoundLevelChange: _onSoundLevelChange); - ); - } else { - _speechToText.listen( - partialResults: partialResults, - listenFor: listenFor, - pauseFor: pauseFor, - cancelOnError: true, - onResult: _onListenResult); - } - } - - /// Stops a current active listening session. - /// - /// Call this after calling [listen] to stop the recognizer from listening further - /// and return the current result as final. - void stop() { - _speechToText.stop(); - notifyListeners(); - } - - /// Cancel a current active listening session. - /// - /// Call this after calling [listen] to stop the recognizer from listening further - /// and ignore any results recognized so far. - void cancel() { - _speechToText.cancel(); - notifyListeners(); - } - - void _onError(SpeechRecognitionError errorNotification) { - _recognitionController.add(SpeechRecognitionEvent( - SpeechRecognitionEventType.errorEvent, - null, - errorNotification, - isListening, - null)); - notifyListeners(); - } - - void _onStatus(String status) { - _recognitionController.add(SpeechRecognitionEvent( - SpeechRecognitionEventType.statusChangeEvent, - null, - null, - isListening, - null)); - notifyListeners(); - } - - void _onListenResult(SpeechRecognitionResult result) { - _lastResult = result; - _recognitionController.add(SpeechRecognitionEvent( - result.finalResult - ? SpeechRecognitionEventType.finalRecognitionEvent - : SpeechRecognitionEventType.partialRecognitionEvent, - result, - null, - isListening, - null)); - notifyListeners(); - } - - // void _onSoundLevelChange(double level) { - // _lastLevel = level; - // _recognitionController.add(SpeechRecognitionEvent( - // SpeechRecognitionEventType.soundLevelChangeEvent, - // null, - // null, - // null, - // level)); - // notifyListeners(); - // } -} diff --git a/speech_to_text/pubspec.lock b/speech_to_text/pubspec.lock deleted file mode 100644 index efc63cc7..00000000 --- a/speech_to_text/pubspec.lock +++ /dev/null @@ -1,462 +0,0 @@ -# Generated by pub -# See https://dart.dev/tools/pub/glossary#lockfile -packages: - _fe_analyzer_shared: - dependency: transitive - description: - name: _fe_analyzer_shared - url: "https://pub.dartlang.org" - source: hosted - version: "5.0.0" - analyzer: - dependency: transitive - description: - name: analyzer - url: "https://pub.dartlang.org" - source: hosted - version: "0.39.13" - args: - dependency: transitive - description: - name: args - url: "https://pub.dartlang.org" - source: hosted - version: "1.6.0" - async: - dependency: transitive - description: - name: async - url: "https://pub.dartlang.org" - source: hosted - version: "2.5.0-nullsafety.1" - boolean_selector: - dependency: transitive - description: - name: boolean_selector - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.0-nullsafety.1" - build: - dependency: transitive - description: - name: build - url: "https://pub.dartlang.org" - source: hosted - version: "1.3.0" - build_config: - dependency: transitive - description: - name: build_config - url: "https://pub.dartlang.org" - source: hosted - version: "0.4.2" - build_daemon: - dependency: transitive - description: - name: build_daemon - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.4" - build_resolvers: - dependency: transitive - description: - name: build_resolvers - url: "https://pub.dartlang.org" - source: hosted - version: "1.3.10" - build_runner: - dependency: "direct dev" - description: - name: build_runner - url: "https://pub.dartlang.org" - source: hosted - version: "1.10.0" - build_runner_core: - dependency: transitive - description: - name: build_runner_core - url: "https://pub.dartlang.org" - source: hosted - version: "5.2.0" - built_collection: - dependency: transitive - description: - name: built_collection - url: "https://pub.dartlang.org" - source: hosted - version: "4.3.2" - built_value: - dependency: transitive - description: - name: built_value - url: "https://pub.dartlang.org" - source: hosted - version: "7.1.0" - characters: - dependency: transitive - description: - name: characters - url: "https://pub.dartlang.org" - source: hosted - version: "1.1.0-nullsafety.3" - charcode: - dependency: transitive - description: - name: charcode - url: "https://pub.dartlang.org" - source: hosted - version: "1.2.0-nullsafety.1" - checked_yaml: - dependency: transitive - description: - name: checked_yaml - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.2" - clock: - dependency: "direct main" - description: - name: clock - url: "https://pub.dartlang.org" - source: hosted - version: "1.1.0-nullsafety.1" - code_builder: - dependency: transitive - description: - name: code_builder - url: "https://pub.dartlang.org" - source: hosted - version: "3.4.0" - collection: - dependency: transitive - description: - name: collection - url: "https://pub.dartlang.org" - source: hosted - version: "1.15.0-nullsafety.3" - convert: - dependency: transitive - description: - name: convert - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.1" - crypto: - dependency: transitive - description: - name: crypto - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.4" - csslib: - dependency: transitive - description: - name: csslib - url: "https://pub.dartlang.org" - source: hosted - version: "0.16.1" - dart_style: - dependency: transitive - description: - name: dart_style - url: "https://pub.dartlang.org" - source: hosted - version: "1.3.6" - fake_async: - dependency: "direct dev" - description: - name: fake_async - url: "https://pub.dartlang.org" - source: hosted - version: "1.2.0-nullsafety.1" - fixnum: - dependency: transitive - description: - name: fixnum - url: "https://pub.dartlang.org" - source: hosted - version: "0.10.11" - flutter: - dependency: "direct main" - description: flutter - source: sdk - version: "0.0.0" - flutter_test: - dependency: "direct dev" - description: flutter - source: sdk - version: "0.0.0" - glob: - dependency: transitive - description: - name: glob - url: "https://pub.dartlang.org" - source: hosted - version: "1.2.0" - graphs: - dependency: transitive - description: - name: graphs - url: "https://pub.dartlang.org" - source: hosted - version: "0.2.0" - html: - dependency: transitive - description: - name: html - url: "https://pub.dartlang.org" - source: hosted - version: "0.14.0+3" - http_multi_server: - dependency: transitive - description: - name: http_multi_server - url: "https://pub.dartlang.org" - source: hosted - version: "2.2.0" - http_parser: - dependency: transitive - description: - name: http_parser - url: "https://pub.dartlang.org" - source: hosted - version: "3.1.4" - io: - dependency: transitive - description: - name: io - url: "https://pub.dartlang.org" - source: hosted - version: "0.3.4" - js: - dependency: transitive - description: - name: js - url: "https://pub.dartlang.org" - source: hosted - version: "0.6.2" - json_annotation: - dependency: "direct main" - description: - name: json_annotation - url: "https://pub.dartlang.org" - source: hosted - version: "3.0.1" - json_serializable: - dependency: "direct dev" - description: - name: json_serializable - url: "https://pub.dartlang.org" - source: hosted - version: "3.3.0" - logging: - dependency: transitive - description: - name: logging - url: "https://pub.dartlang.org" - source: hosted - version: "0.11.4" - matcher: - dependency: transitive - description: - name: matcher - url: "https://pub.dartlang.org" - source: hosted - version: "0.12.10-nullsafety.1" - meta: - dependency: transitive - description: - name: meta - url: "https://pub.dartlang.org" - source: hosted - version: "1.3.0-nullsafety.3" - mime: - dependency: transitive - description: - name: mime - url: "https://pub.dartlang.org" - source: hosted - version: "0.9.6+3" - node_interop: - dependency: transitive - description: - name: node_interop - url: "https://pub.dartlang.org" - source: hosted - version: "1.1.1" - node_io: - dependency: transitive - description: - name: node_io - url: "https://pub.dartlang.org" - source: hosted - version: "1.1.1" - package_config: - dependency: transitive - description: - name: package_config - url: "https://pub.dartlang.org" - source: hosted - version: "1.9.3" - path: - dependency: transitive - description: - name: path - url: "https://pub.dartlang.org" - source: hosted - version: "1.8.0-nullsafety.1" - pedantic: - dependency: transitive - description: - name: pedantic - url: "https://pub.dartlang.org" - source: hosted - version: "1.9.0" - pool: - dependency: transitive - description: - name: pool - url: "https://pub.dartlang.org" - source: hosted - version: "1.4.0" - pub_semver: - dependency: transitive - description: - name: pub_semver - url: "https://pub.dartlang.org" - source: hosted - version: "1.4.4" - pubspec_parse: - dependency: transitive - description: - name: pubspec_parse - url: "https://pub.dartlang.org" - source: hosted - version: "0.1.5" - quiver: - dependency: transitive - description: - name: quiver - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.3" - shelf: - dependency: transitive - description: - name: shelf - url: "https://pub.dartlang.org" - source: hosted - version: "0.7.7" - shelf_web_socket: - dependency: transitive - description: - name: shelf_web_socket - url: "https://pub.dartlang.org" - source: hosted - version: "0.2.3" - sky_engine: - dependency: transitive - description: flutter - source: sdk - version: "0.0.99" - source_gen: - dependency: transitive - description: - name: source_gen - url: "https://pub.dartlang.org" - source: hosted - version: "0.9.6" - source_span: - dependency: transitive - description: - name: source_span - url: "https://pub.dartlang.org" - source: hosted - version: "1.8.0-nullsafety.2" - stack_trace: - dependency: transitive - description: - name: stack_trace - url: "https://pub.dartlang.org" - source: hosted - version: "1.10.0-nullsafety.1" - stream_channel: - dependency: transitive - description: - name: stream_channel - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.0-nullsafety.1" - stream_transform: - dependency: transitive - description: - name: stream_transform - url: "https://pub.dartlang.org" - source: hosted - version: "1.2.0" - string_scanner: - dependency: transitive - description: - name: string_scanner - url: "https://pub.dartlang.org" - source: hosted - version: "1.1.0-nullsafety.1" - term_glyph: - dependency: transitive - description: - name: term_glyph - url: "https://pub.dartlang.org" - source: hosted - version: "1.2.0-nullsafety.1" - test_api: - dependency: transitive - description: - name: test_api - url: "https://pub.dartlang.org" - source: hosted - version: "0.2.19-nullsafety.2" - timing: - dependency: transitive - description: - name: timing - url: "https://pub.dartlang.org" - source: hosted - version: "0.1.1+2" - typed_data: - dependency: transitive - description: - name: typed_data - url: "https://pub.dartlang.org" - source: hosted - version: "1.3.0-nullsafety.3" - vector_math: - dependency: transitive - description: - name: vector_math - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.0-nullsafety.3" - watcher: - dependency: transitive - description: - name: watcher - url: "https://pub.dartlang.org" - source: hosted - version: "0.9.7+15" - web_socket_channel: - dependency: transitive - description: - name: web_socket_channel - url: "https://pub.dartlang.org" - source: hosted - version: "1.1.0" - yaml: - dependency: transitive - description: - name: yaml - url: "https://pub.dartlang.org" - source: hosted - version: "2.2.1" -sdks: - dart: ">=2.10.0-110 <2.11.0" - flutter: ">=1.10.0" diff --git a/speech_to_text/pubspec.yaml b/speech_to_text/pubspec.yaml deleted file mode 100644 index 34b3da29..00000000 --- a/speech_to_text/pubspec.yaml +++ /dev/null @@ -1,31 +0,0 @@ -name: speech_to_text -description: A Flutter plugin that exposes device specific speech to text recognition capability. - - - -environment: - sdk: ">=2.1.0 <3.0.0" - flutter: ">=1.10.0" - -dependencies: - flutter: - sdk: flutter - json_annotation: ^3.0.0 - clock: ^1.0.1 - -dev_dependencies: - flutter_test: - sdk: flutter - build_runner: ^1.0.0 - json_serializable: ^3.0.0 - fake_async: ^1.0.1 - -flutter: - plugin: - platforms: - android: - package: com.csdcorp.speech_to_text - pluginClass: SpeechToTextPlugin - ios: - pluginClass: SpeechToTextPlugin - diff --git a/speech_to_text/test/speech_recognition_error_test.dart b/speech_to_text/test/speech_recognition_error_test.dart deleted file mode 100644 index 202ae4cd..00000000 --- a/speech_to_text/test/speech_recognition_error_test.dart +++ /dev/null @@ -1,65 +0,0 @@ -import 'dart:convert'; - -import 'package:flutter_test/flutter_test.dart'; -import 'package:speech_to_text/speech_recognition_error.dart'; - -void main() { - const String msg1 = "msg1"; - - setUp(() {}); - - group('properties', () { - test('equals true for same object', () { - SpeechRecognitionError error = SpeechRecognitionError(msg1, false); - expect(error, error); - }); - test('equals true for different object same values', () { - SpeechRecognitionError error1 = SpeechRecognitionError(msg1, false); - SpeechRecognitionError error2 = SpeechRecognitionError(msg1, false); - expect(error1, error2); - }); - test('equals false for different object', () { - SpeechRecognitionError error1 = SpeechRecognitionError(msg1, false); - SpeechRecognitionError error2 = SpeechRecognitionError("msg2", false); - expect(error1, isNot(error2)); - }); - test('hash same for same object', () { - SpeechRecognitionError error = SpeechRecognitionError(msg1, false); - expect(error.hashCode, error.hashCode); - }); - test('hash same for different object same values', () { - SpeechRecognitionError error1 = SpeechRecognitionError(msg1, false); - SpeechRecognitionError error2 = SpeechRecognitionError(msg1, false); - expect(error1.hashCode, error2.hashCode); - }); - test('hash different for different object', () { - SpeechRecognitionError error1 = SpeechRecognitionError(msg1, false); - SpeechRecognitionError error2 = SpeechRecognitionError("msg2", false); - expect(error1.hashCode, isNot(error2.hashCode)); - }); - test('toString as expected', () { - SpeechRecognitionError error1 = SpeechRecognitionError(msg1, false); - expect(error1.toString(), - "SpeechRecognitionError msg: $msg1, permanent: false"); - }); - }); - group('json', () { - test('loads properly', () { - var json = jsonDecode('{"errorMsg":"$msg1","permanent":true}'); - SpeechRecognitionError error = SpeechRecognitionError.fromJson(json); - expect(error.errorMsg, msg1); - expect(error.permanent, isTrue); - json = jsonDecode('{"errorMsg":"$msg1","permanent":false}'); - error = SpeechRecognitionError.fromJson(json); - expect(error.permanent, isFalse); - }); - test('roundtrips properly', () { - var json = jsonDecode('{"errorMsg":"$msg1","permanent":true}'); - SpeechRecognitionError error = SpeechRecognitionError.fromJson(json); - var roundtripJson = error.toJson(); - SpeechRecognitionError roundtripError = - SpeechRecognitionError.fromJson(roundtripJson); - expect(error, roundtripError); - }); - }); -} diff --git a/speech_to_text/test/speech_recognition_event_test.dart b/speech_to_text/test/speech_recognition_event_test.dart deleted file mode 100644 index ceaaab8a..00000000 --- a/speech_to_text/test/speech_recognition_event_test.dart +++ /dev/null @@ -1,42 +0,0 @@ -import 'package:flutter_test/flutter_test.dart'; -import 'package:speech_to_text/speech_recognition_event.dart'; - -import 'test_speech_channel_handler.dart'; - -void main() { - group('properties', () { - test('status listening matches', () { - var event = SpeechRecognitionEvent( - SpeechRecognitionEventType.statusChangeEvent, null, null, true, null); - expect(event.eventType, SpeechRecognitionEventType.statusChangeEvent); - expect(event.isListening, isTrue); - }); - test('result matches', () { - var event = SpeechRecognitionEvent( - SpeechRecognitionEventType.finalRecognitionEvent, - TestSpeechChannelHandler.firstRecognizedResult, - null, - null, - null); - expect(event.eventType, SpeechRecognitionEventType.finalRecognitionEvent); - expect(event.recognitionResult, - TestSpeechChannelHandler.firstRecognizedResult); - }); - test('error matches', () { - var event = SpeechRecognitionEvent(SpeechRecognitionEventType.errorEvent, - null, TestSpeechChannelHandler.firstError, null, null); - expect(event.eventType, SpeechRecognitionEventType.errorEvent); - expect(event.error, TestSpeechChannelHandler.firstError); - }); - test('sound level matches', () { - var event = SpeechRecognitionEvent( - SpeechRecognitionEventType.soundLevelChangeEvent, - null, - null, - null, - TestSpeechChannelHandler.level1); - expect(event.eventType, SpeechRecognitionEventType.soundLevelChangeEvent); - expect(event.level, TestSpeechChannelHandler.level1); - }); - }); -} diff --git a/speech_to_text/test/speech_recognition_result_test.dart b/speech_to_text/test/speech_recognition_result_test.dart deleted file mode 100644 index 1516779a..00000000 --- a/speech_to_text/test/speech_recognition_result_test.dart +++ /dev/null @@ -1,134 +0,0 @@ -import 'dart:convert'; - -import 'package:flutter_test/flutter_test.dart'; -import 'package:speech_to_text/speech_recognition_result.dart'; - -void main() { - final String firstRecognizedWords = 'hello'; - final String secondRecognizedWords = 'hello there'; - final double firstConfidence = 0.85; - final double secondConfidence = 0.62; - final String firstRecognizedJson = - '{"alternates":[{"recognizedWords":"$firstRecognizedWords","confidence":$firstConfidence}],"finalResult":false}'; - final String secondRecognizedJson = - '{"alternates":[{"recognizedWords":"$secondRecognizedWords","confidence":$secondConfidence}],"finalResult":false}'; - final SpeechRecognitionWords firstWords = - SpeechRecognitionWords(firstRecognizedWords, firstConfidence); - final SpeechRecognitionWords secondWords = - SpeechRecognitionWords(secondRecognizedWords, secondConfidence); - - setUp(() {}); - - group('recognizedWords', () { - test('empty if no alternates', () { - SpeechRecognitionResult result = SpeechRecognitionResult([], true); - expect(result.recognizedWords, isEmpty); - }); - test('matches first alternate', () { - SpeechRecognitionResult result = - SpeechRecognitionResult([firstWords, secondWords], true); - expect(result.recognizedWords, firstRecognizedWords); - }); - }); - group('alternates', () { - test('empty if no alternates', () { - SpeechRecognitionResult result = SpeechRecognitionResult([], true); - expect(result.alternates, isEmpty); - }); - test('expected contents', () { - SpeechRecognitionResult result = - SpeechRecognitionResult([firstWords, secondWords], true); - expect(result.alternates, contains(firstWords)); - expect(result.alternates, contains(secondWords)); - }); - test('in order', () { - SpeechRecognitionResult result = - SpeechRecognitionResult([firstWords, secondWords], true); - expect(result.alternates.first, firstWords); - }); - }); - group('confidence', () { - test('0 if no alternates', () { - SpeechRecognitionResult result = SpeechRecognitionResult([], true); - expect(result.confidence, 0); - }); - test('isConfident false if no alternates', () { - SpeechRecognitionResult result = SpeechRecognitionResult([], true); - expect(result.isConfident(), isFalse); - }); - test('isConfident matches first alternate', () { - SpeechRecognitionResult result = - SpeechRecognitionResult([firstWords, secondWords], true); - expect(result.isConfident(), firstWords.isConfident()); - }); - test('hasConfidenceRating false if no alternates', () { - SpeechRecognitionResult result = SpeechRecognitionResult([], true); - expect(result.hasConfidenceRating, isFalse); - }); - test('hasConfidenceRating matches first alternate', () { - SpeechRecognitionResult result = - SpeechRecognitionResult([firstWords, secondWords], true); - expect(result.hasConfidenceRating, firstWords.hasConfidenceRating); - }); - }); - group('json', () { - test('loads correctly', () { - var json = jsonDecode(firstRecognizedJson); - SpeechRecognitionResult result = SpeechRecognitionResult.fromJson(json); - expect(result.recognizedWords, firstRecognizedWords); - expect(result.confidence, firstConfidence); - }); - test('roundtrips correctly', () { - var json = jsonDecode(firstRecognizedJson); - SpeechRecognitionResult result = SpeechRecognitionResult.fromJson(json); - var roundTripJson = result.toJson(); - SpeechRecognitionResult roundtripResult = - SpeechRecognitionResult.fromJson(roundTripJson); - expect(result, roundtripResult); - }); - }); - group('overrides', () { - test('toString works with no alternates', () { - SpeechRecognitionResult result = SpeechRecognitionResult([], true); - expect( - result.toString(), "SpeechRecognitionResult words: [], final: true"); - }); - test('toString works with alternates', () { - SpeechRecognitionResult result = - SpeechRecognitionResult([firstWords], true); - expect(result.toString(), - "SpeechRecognitionResult words: [SpeechRecognitionWords words: hello, confidence: 0.85], final: true"); - }); - test('hash same for same object', () { - SpeechRecognitionResult result = - SpeechRecognitionResult([firstWords], true); - expect(result.hashCode, result.hashCode); - }); - test('hash differs for different objects', () { - SpeechRecognitionResult result1 = - SpeechRecognitionResult([firstWords], true); - SpeechRecognitionResult result2 = - SpeechRecognitionResult([secondWords], true); - expect(result1.hashCode, isNot(result2.hashCode)); - }); - test('equals same for same object', () { - SpeechRecognitionResult result = - SpeechRecognitionResult([firstWords], true); - expect(result, result); - }); - test('equals same for different object same values', () { - SpeechRecognitionResult result1 = - SpeechRecognitionResult([firstWords], true); - SpeechRecognitionResult result1a = - SpeechRecognitionResult([firstWords], true); - expect(result1, result1a); - }); - test('equals differs for different objects', () { - SpeechRecognitionResult result1 = - SpeechRecognitionResult([firstWords], true); - SpeechRecognitionResult result2 = - SpeechRecognitionResult([secondWords], true); - expect(result1, isNot(result2)); - }); - }); -} diff --git a/speech_to_text/test/speech_recognitions_words_test.dart b/speech_to_text/test/speech_recognitions_words_test.dart deleted file mode 100644 index 36a9ef0e..00000000 --- a/speech_to_text/test/speech_recognitions_words_test.dart +++ /dev/null @@ -1,86 +0,0 @@ -import 'dart:convert'; - -import 'package:flutter_test/flutter_test.dart'; -import 'package:speech_to_text/speech_recognition_result.dart'; - -void main() { - final String firstRecognizedWords = 'hello'; - final String secondRecognizedWords = 'hello there'; - final double firstConfidence = 0.85; - final double secondConfidence = 0.62; - final String firstRecognizedJson = - '{"recognizedWords":"$firstRecognizedWords","confidence":$firstConfidence}'; - final SpeechRecognitionWords firstWords = - SpeechRecognitionWords(firstRecognizedWords, firstConfidence); - final SpeechRecognitionWords secondWords = - SpeechRecognitionWords(secondRecognizedWords, secondConfidence); - - setUp(() {}); - - group('properties', () { - test('words', () { - expect(firstWords.recognizedWords, firstRecognizedWords); - expect(secondWords.recognizedWords, secondRecognizedWords); - }); - test('confidence', () { - expect(firstWords.confidence, firstConfidence); - expect(secondWords.confidence, secondConfidence); - expect(firstWords.hasConfidenceRating, isTrue); - }); - test('equals true for same object', () { - expect(firstWords, firstWords); - }); - test('equals true for different object with same values', () { - SpeechRecognitionWords firstWordsA = - SpeechRecognitionWords(firstRecognizedWords, firstConfidence); - expect(firstWords, firstWordsA); - }); - test('equals false for different results', () { - expect(firstWords, isNot(secondWords)); - }); - test('hash same for same object', () { - expect(firstWords.hashCode, firstWords.hashCode); - }); - test('hash same for different object with same values', () { - SpeechRecognitionWords firstWordsA = - SpeechRecognitionWords(firstRecognizedWords, firstConfidence); - expect(firstWords.hashCode, firstWordsA.hashCode); - }); - test('hash different for different results', () { - expect(firstWords.hashCode, isNot(secondWords.hashCode)); - }); - }); - group('isConfident', () { - test('true when >= 0.8', () { - expect(firstWords.isConfident(), isTrue); - }); - test('false when < 0.8', () { - expect(secondWords.isConfident(), isFalse); - }); - test('respects threshold', () { - expect(secondWords.isConfident(threshold: 0.5), isTrue); - }); - test('true when missing', () { - SpeechRecognitionWords words = SpeechRecognitionWords( - firstRecognizedWords, SpeechRecognitionWords.missingConfidence); - expect(words.isConfident(), isTrue); - expect(words.hasConfidenceRating, isFalse); - }); - }); - group('json', () { - test('loads correctly', () { - var json = jsonDecode(firstRecognizedJson); - SpeechRecognitionWords words = SpeechRecognitionWords.fromJson(json); - expect(words.recognizedWords, firstRecognizedWords); - expect(words.confidence, firstConfidence); - }); - test('roundtrips correctly', () { - var json = jsonDecode(firstRecognizedJson); - SpeechRecognitionWords words = SpeechRecognitionWords.fromJson(json); - var roundTripJson = words.toJson(); - SpeechRecognitionWords roundtripWords = - SpeechRecognitionWords.fromJson(roundTripJson); - expect(words, roundtripWords); - }); - }); -} diff --git a/speech_to_text/test/speech_to_text_provider_test.dart b/speech_to_text/test/speech_to_text_provider_test.dart deleted file mode 100644 index 25366b6f..00000000 --- a/speech_to_text/test/speech_to_text_provider_test.dart +++ /dev/null @@ -1,196 +0,0 @@ -import 'package:fake_async/fake_async.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:speech_to_text/speech_to_text.dart'; -import 'package:speech_to_text/speech_to_text_provider.dart'; - -import 'test_speech_channel_handler.dart'; -import 'test_speech_listener.dart'; - -void main() { - SpeechToTextProvider provider; - SpeechToText speechToText; - TestSpeechChannelHandler speechHandler; - TestSpeechListener speechListener; - - TestWidgetsFlutterBinding.ensureInitialized(); - - setUp(() { - speechToText = SpeechToText.withMethodChannel(SpeechToText.speechChannel); - speechHandler = TestSpeechChannelHandler(speechToText); - speechToText.channel - .setMockMethodCallHandler(speechHandler.methodCallHandler); - provider = SpeechToTextProvider(speechToText); - speechListener = TestSpeechListener(provider); - provider.addListener(speechListener.onNotify); - }); - - tearDown(() { - speechToText.channel.setMockMethodCallHandler(null); - }); - - group('delegates', () { - test('isListening matches delegate defaults', () { - expect(provider.isListening, speechToText.isListening); - expect(provider.isNotListening, speechToText.isNotListening); - }); - test('isAvailable matches delegate defaults', () { - expect(provider.isAvailable, speechToText.isAvailable); - expect(provider.isNotAvailable, !speechToText.isAvailable); - }); - test('isAvailable matches delegate after init', () async { - expect(await provider.initialize(), isTrue); - expect(provider.isAvailable, speechToText.isAvailable); - expect(provider.isNotAvailable, !speechToText.isAvailable); - }); - test('hasError matches delegate after error', () async { - expect(await provider.initialize(), isTrue); - expect(provider.hasError, speechToText.hasError); - }); - }); - group('listening', () { - test('notifies on initialize', () async { - fakeAsync((fa) { - provider.initialize(); - fa.flushMicrotasks(); - expect(speechListener.notified, isTrue); - expect(speechListener.isAvailable, isTrue); - }); - }); - test('notifies on listening', () async { - fakeAsync((fa) { - setupForListen(provider, fa, speechListener); - expect(speechListener.notified, isTrue); - expect(speechListener.isListening, isTrue); - expect(provider.hasResults, isFalse); - }); - }); - test('notifies on final words', () async { - fakeAsync((fa) { - setupForListen(provider, fa, speechListener); - speechListener.reset(); - speechHandler.notifyFinalWords(); - fa.flushMicrotasks(); - expect(speechListener.notified, isTrue); - expect(provider.hasResults, isTrue); - var result = speechListener.recognitionResult; - expect(result.recognizedWords, - TestSpeechChannelHandler.secondRecognizedWords); - expect(result.finalResult, isTrue); - }); - }); - test('hasResult false after listening before new results', () async { - fakeAsync((fa) { - setupForListen(provider, fa, speechListener); - speechHandler.notifyFinalWords(); - provider.stop(); - setupForListen(provider, fa, speechListener); - fa.flushMicrotasks(); - expect(provider.hasResults, isFalse); - }); - }); - test('notifies on partial words', () async { - fakeAsync((fa) { - setupForListen(provider, fa, speechListener, partialResults: true); - speechListener.reset(); - speechHandler.notifyPartialWords(); - fa.flushMicrotasks(); - expect(speechListener.notified, isTrue); - expect(provider.hasResults, isTrue); - var result = speechListener.recognitionResult; - expect(result.recognizedWords, - TestSpeechChannelHandler.firstRecognizedWords); - expect(result.finalResult, isFalse); - }); - }); - }); - group('soundLevel', () { - test('notifies when requested', () async { - fakeAsync((fa) { - setupForListen(provider, fa, speechListener, - partialResults: true, soundLevel: true); - speechListener.reset(); - speechHandler.notifySoundLevel(); - fa.flushMicrotasks(); - expect(speechListener.notified, isTrue); - expect(speechListener.soundLevel, TestSpeechChannelHandler.level2); - }); - }); - test('no notification by default', () async { - fakeAsync((fa) { - setupForListen(provider, fa, speechListener, - partialResults: true, soundLevel: false); - speechListener.reset(); - speechHandler.notifySoundLevel(); - fa.flushMicrotasks(); - expect(speechListener.notified, isFalse); - expect(speechListener.soundLevel, 0); - }); - }); - }); - group('stop/cancel', () { - test('notifies on stop', () async { - fakeAsync((fa) { - provider.initialize(); - setupForListen(provider, fa, speechListener); - speechListener.reset(); - provider.stop(); - fa.flushMicrotasks(); - expect(speechListener.notified, isTrue); - expect(speechListener.isListening, isFalse); - }); - }); - test('notifies on cancel', () async { - fakeAsync((fa) { - provider.initialize(); - setupForListen(provider, fa, speechListener); - speechListener.reset(); - provider.cancel(); - fa.flushMicrotasks(); - expect(speechListener.notified, isTrue); - expect(speechListener.isListening, isFalse); - }); - }); - }); - group('error handling', () { - test('hasError matches delegate default', () async { - expect(await provider.initialize(), isTrue); - expect(provider.hasError, speechToText.hasError); - }); - test('notifies on error', () async { - fakeAsync((fa) { - provider.initialize(); - setupForListen(provider, fa, speechListener); - speechListener.reset(); - speechHandler.notifyPermanentError(); - expect(speechListener.notified, isTrue); - expect(speechListener.hasError, isTrue); - }); - }); - }); - group('locale', () { - test('locales empty before init', () async { - expect(provider.systemLocale, isNull); - expect(provider.locales, isEmpty); - }); - test('set from SpeechToText after init', () async { - fakeAsync((fa) { - speechHandler.setupLocales(); - provider.initialize(); - fa.flushMicrotasks(); - expect( - provider.systemLocale.localeId, TestSpeechChannelHandler.localeId1); - expect(provider.locales, hasLength(speechHandler.locales.length)); - }); - }); - }); -} - -void setupForListen(SpeechToTextProvider provider, FakeAsync fa, - TestSpeechListener speechListener, - {bool partialResults = false, bool soundLevel = false}) { - provider.initialize(); - fa.flushMicrotasks(); - speechListener.reset(); - provider.listen(partialResults: partialResults, soundLevel: soundLevel); - fa.flushMicrotasks(); -} diff --git a/speech_to_text/test/speech_to_text_test.dart b/speech_to_text/test/speech_to_text_test.dart deleted file mode 100644 index 7b4701ff..00000000 --- a/speech_to_text/test/speech_to_text_test.dart +++ /dev/null @@ -1,425 +0,0 @@ -import 'package:fake_async/fake_async.dart'; -import 'package:flutter/services.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:speech_to_text/speech_recognition_error.dart'; -import 'package:speech_to_text/speech_recognition_result.dart'; -import 'package:speech_to_text/speech_to_text.dart'; - -import 'test_speech_channel_handler.dart'; - -void main() { - TestWidgetsFlutterBinding.ensureInitialized(); - - TestSpeechListener listener; - TestSpeechChannelHandler speechHandler; - SpeechToText speech; - - setUp(() { - listener = TestSpeechListener(); - speech = SpeechToText.withMethodChannel(SpeechToText.speechChannel); - speechHandler = TestSpeechChannelHandler(speech); - speech.channel.setMockMethodCallHandler(speechHandler.methodCallHandler); - }); - - tearDown(() { - speech.channel.setMockMethodCallHandler(null); - }); - - group('hasPermission', () { - test('true if platform reports true', () async { - expect(await speech.hasPermission, true); - }); - test('false if platform reports false', () async { - speechHandler.hasPermissionResult = false; - expect(await speech.hasPermission, false); - }); - }); - group('init', () { - test('succeeds on platform success', () async { - expect(await speech.initialize(), true); - expect(speechHandler.initInvoked, true); - expect(speech.isAvailable, true); - }); - test('only invokes once', () async { - expect(await speech.initialize(), true); - speechHandler.initInvoked = false; - expect(await speech.initialize(), true); - expect(speechHandler.initInvoked, false); - }); - test('fails on platform failure', () async { - speechHandler.initResult = false; - expect(await speech.initialize(), false); - expect(speech.isAvailable, false); - }); - }); - - group('listen', () { - test('fails with exception if not initialized', () async { - try { - await speech.listen(); - fail("Expected an exception."); - } on SpeechToTextNotInitializedException { - // This is a good result - } - }); - test('fails with exception if init fails', () async { - try { - speechHandler.initResult = false; - await speech.initialize(); - await speech.listen(); - fail("Expected an exception."); - } on SpeechToTextNotInitializedException { - // This is a good result - } - }); - test('invokes listen after successful init', () async { - await speech.initialize(); - await speech.listen(); - expect(speechHandler.listenLocale, isNull); - expect(speechHandler.listenInvoked, true); - }); - test('converts platformException to listenFailed', () async { - await speech.initialize(); - speechHandler.listenException = true; - try { - await speech.listen(); - fail("Should have thrown"); - } on ListenFailedException catch (e) { - expect(e.details, TestSpeechChannelHandler.listenExceptionDetails); - } catch (wrongE) { - fail("Should have been ListenFailedException"); - } - }); - test('stops listen after listenFor duration', () async { - fakeAsync((fa) { - speech.initialize(); - fa.flushMicrotasks(); - speech.listen(listenFor: Duration(seconds: 2)); - fa.flushMicrotasks(); - expect(speech.isListening, isTrue); - fa.elapse(Duration(seconds: 2)); - expect(speech.isListening, isFalse); - }); - }); - test('stops listen after listenFor duration even with speech event', - () async { - fakeAsync((fa) { - speech.initialize(); - fa.flushMicrotasks(); - speech.listen(listenFor: Duration(seconds: 1)); - speech.processMethodCall(MethodCall(SpeechToText.textRecognitionMethod, - TestSpeechChannelHandler.firstRecognizedJson)); - fa.flushMicrotasks(); - expect(speech.isListening, isTrue); - fa.elapse(Duration(seconds: 1)); - expect(speech.isListening, isFalse); - }); - }); - test('stops listen after pauseFor duration with no speech', () async { - fakeAsync((fa) { - speech.initialize(); - fa.flushMicrotasks(); - speech.listen(pauseFor: Duration(seconds: 2)); - fa.flushMicrotasks(); - expect(speech.isListening, isTrue); - fa.elapse(Duration(seconds: 2)); - expect(speech.isListening, isFalse); - }); - }); - test('stops listen after pauseFor with longer listenFor duration', - () async { - fakeAsync((fa) { - speech.initialize(); - fa.flushMicrotasks(); - speech.listen( - pauseFor: Duration(seconds: 1), listenFor: Duration(seconds: 5)); - fa.flushMicrotasks(); - expect(speech.isListening, isTrue); - fa.elapse(Duration(seconds: 1)); - expect(speech.isListening, isFalse); - }); - }); - test('stops listen after listenFor with longer pauseFor duration', - () async { - fakeAsync((fa) { - speech.initialize(); - fa.flushMicrotasks(); - speech.listen( - listenFor: Duration(seconds: 1), pauseFor: Duration(seconds: 5)); - fa.flushMicrotasks(); - expect(speech.isListening, isTrue); - fa.elapse(Duration(seconds: 1)); - expect(speech.isListening, isFalse); - }); - }); - test('keeps listening after pauseFor with speech event', () async { - fakeAsync((fa) { - speech.initialize(); - fa.flushMicrotasks(); - speech.listen(pauseFor: Duration(seconds: 2)); - fa.flushMicrotasks(); - fa.elapse(Duration(seconds: 1)); - speech.processMethodCall(MethodCall(SpeechToText.textRecognitionMethod, - TestSpeechChannelHandler.firstRecognizedJson)); - fa.flushMicrotasks(); - fa.elapse(Duration(seconds: 1)); - expect(speech.isListening, isTrue); - }); - }); - test('uses localeId if provided', () async { - await speech.initialize(); - await speech.listen(localeId: TestSpeechChannelHandler.localeId1); - expect(speechHandler.listenInvoked, true); - expect(speechHandler.listenLocale, TestSpeechChannelHandler.localeId1); - }); - test('calls speech listener', () async { - await speech.initialize(); - await speech.listen(onResult: listener.onSpeechResult); - await speech.processMethodCall(MethodCall( - SpeechToText.textRecognitionMethod, - TestSpeechChannelHandler.firstRecognizedJson)); - expect(listener.speechResults, 1); - expect( - listener.results, [TestSpeechChannelHandler.firstRecognizedResult]); - expect(speech.lastRecognizedWords, - TestSpeechChannelHandler.firstRecognizedWords); - }); - test('calls speech listener with multiple', () async { - await speech.initialize(); - await speech.listen(onResult: listener.onSpeechResult); - await speech.processMethodCall(MethodCall( - SpeechToText.textRecognitionMethod, - TestSpeechChannelHandler.firstRecognizedJson)); - await speech.processMethodCall(MethodCall( - SpeechToText.textRecognitionMethod, - TestSpeechChannelHandler.secondRecognizedJson)); - expect(listener.speechResults, 2); - expect(listener.results, [ - TestSpeechChannelHandler.firstRecognizedResult, - TestSpeechChannelHandler.secondRecognizedResult - ]); - expect(speech.lastRecognizedWords, - TestSpeechChannelHandler.secondRecognizedWords); - }); - }); - - group('status callback', () { - test('invoked on listen', () async { - await speech.initialize( - onError: listener.onSpeechError, onStatus: listener.onSpeechStatus); - await speech.processMethodCall(MethodCall( - SpeechToText.notifyStatusMethod, SpeechToText.listeningStatus)); - expect(listener.speechStatus, 1); - expect(listener.statuses.contains(SpeechToText.listeningStatus), true); - }); - }); - - group('soundLevel callback', () { - test('invoked on listen', () async { - await speech.initialize(); - await speech.listen(onSoundLevelChange: listener.onSoundLevel); - await speech.processMethodCall(MethodCall( - SpeechToText.soundLevelChangeMethod, - TestSpeechChannelHandler.level1)); - expect(listener.soundLevel, 1); - expect(listener.soundLevels, contains(TestSpeechChannelHandler.level1)); - }); - test('sets lastLevel', () async { - await speech.initialize(); - await speech.listen(onSoundLevelChange: listener.onSoundLevel); - await speech.processMethodCall(MethodCall( - SpeechToText.soundLevelChangeMethod, - TestSpeechChannelHandler.level1)); - expect(speech.lastSoundLevel, TestSpeechChannelHandler.level1); - }); - }); - - group('cancel', () { - test('does nothing if not initialized', () async { - speech.cancel(); - expect(speechHandler.cancelInvoked, false); - }); - test('cancels an active listen', () async { - await speech.initialize(); - await speech.listen(); - await speech.cancel(); - expect(speechHandler.cancelInvoked, true); - expect(speech.isListening, isFalse); - }); - }); - group('stop', () { - test('does nothing if not initialized', () async { - speech.stop(); - expect(speechHandler.cancelInvoked, false); - }); - test('stops an active listen', () async { - await speech.initialize(); - speech.listen(); - speech.stop(); - expect(speechHandler.stopInvoked, true); - }); - }); - group('error', () { - test('notifies handler with transient', () async { - await speech.initialize(onError: listener.onSpeechError); - await speech.listen(); - await speech.processMethodCall(MethodCall(SpeechToText.notifyErrorMethod, - TestSpeechChannelHandler.transientErrorJson)); - expect(listener.speechErrors, 1); - expect(listener.errors.first.permanent, isFalse); - }); - test('notifies handler with permanent', () async { - await speech.initialize(onError: listener.onSpeechError); - await speech.listen(); - await speech.processMethodCall(MethodCall(SpeechToText.notifyErrorMethod, - TestSpeechChannelHandler.permanentErrorJson)); - expect(listener.speechErrors, 1); - expect(listener.errors.first.permanent, isTrue); - }); - test('continues listening on transient', () async { - await speech.initialize(onError: listener.onSpeechError); - await speech.listen(); - await speech.processMethodCall(MethodCall(SpeechToText.notifyErrorMethod, - TestSpeechChannelHandler.transientErrorJson)); - expect(speech.isListening, isTrue); - }); - test('continues listening on permanent if cancel not explicitly requested', - () async { - await speech.initialize(onError: listener.onSpeechError); - await speech.listen(); - await speech.processMethodCall(MethodCall(SpeechToText.notifyErrorMethod, - TestSpeechChannelHandler.permanentErrorJson)); - expect(speech.isListening, isTrue); - }); - test('stops listening on permanent if cancel explicitly requested', - () async { - await speech.initialize(onError: listener.onSpeechError); - await speech.listen(cancelOnError: true); - await speech.processMethodCall(MethodCall(SpeechToText.notifyErrorMethod, - TestSpeechChannelHandler.permanentErrorJson)); - expect(speech.isListening, isFalse); - }); - test('Error not sent after cancel', () async { - await speech.initialize(onError: listener.onSpeechError); - await speech.listen(); - await speech.cancel(); - await speech.processMethodCall(MethodCall(SpeechToText.notifyErrorMethod, - TestSpeechChannelHandler.permanentErrorJson)); - expect(speech.isListening, isFalse); - expect(listener.speechErrors, 0); - }); - test('Error still sent after implicit cancel', () async { - await speech.initialize(onError: listener.onSpeechError); - await speech.listen(cancelOnError: true); - await speech.processMethodCall(MethodCall(SpeechToText.notifyErrorMethod, - TestSpeechChannelHandler.permanentErrorJson)); - await speech.processMethodCall(MethodCall(SpeechToText.notifyErrorMethod, - TestSpeechChannelHandler.permanentErrorJson)); - expect(speech.isListening, isFalse); - expect(listener.speechErrors, 2); - }); - }); - group('locales', () { - test('fails with exception if not initialized', () async { - try { - await speech.locales(); - fail("Expected an exception."); - } on SpeechToTextNotInitializedException { - // This is a good result - } - }); - test('system locale null if not initialized', () async { - LocaleName current; - try { - current = await speech.systemLocale(); - fail("Expected an exception."); - } on SpeechToTextNotInitializedException { - expect(current, isNull); - } - }); - test('handles an empty list', () async { - await speech.initialize(onError: listener.onSpeechError); - List localeNames = await speech.locales(); - expect(speechHandler.localesInvoked, isTrue); - expect(localeNames, isEmpty); - }); - test('returns expected locales', () async { - await speech.initialize(onError: listener.onSpeechError); - speechHandler.locales.add(TestSpeechChannelHandler.locale1); - speechHandler.locales.add(TestSpeechChannelHandler.locale2); - List localeNames = await speech.locales(); - expect(localeNames, hasLength(speechHandler.locales.length)); - expect(localeNames[0].localeId, TestSpeechChannelHandler.localeId1); - expect(localeNames[0].name, TestSpeechChannelHandler.name1); - expect(localeNames[1].localeId, TestSpeechChannelHandler.localeId2); - expect(localeNames[1].name, TestSpeechChannelHandler.name2); - }); - test('skips incorrect locales', () async { - await speech.initialize(onError: listener.onSpeechError); - speechHandler.locales.add("InvalidJunk"); - speechHandler.locales.add(TestSpeechChannelHandler.locale1); - List localeNames = await speech.locales(); - expect(localeNames, hasLength(1)); - expect(localeNames[0].localeId, TestSpeechChannelHandler.localeId1); - expect(localeNames[0].name, TestSpeechChannelHandler.name1); - }); - test('system locale matches first returned locale', () async { - await speech.initialize(onError: listener.onSpeechError); - speechHandler.locales.add(TestSpeechChannelHandler.locale1); - speechHandler.locales.add(TestSpeechChannelHandler.locale2); - LocaleName current = await speech.systemLocale(); - expect(current.localeId, TestSpeechChannelHandler.localeId1); - }); - }); - group('status', () { - test('recognized false at start', () async { - expect(speech.hasRecognized, isFalse); - }); - test('listening false at start', () async { - expect(speech.isListening, isFalse); - }); - }); - test('available false at start', () async { - expect(speech.isAvailable, isFalse); - }); - test('hasError false at start', () async { - expect(speech.hasError, isFalse); - }); - test('lastError null at start', () async { - expect(speech.lastError, isNull); - }); - test('status empty at start', () async { - expect(speech.lastStatus, isEmpty); - }); -} - -class TestSpeechListener { - int speechResults = 0; - List results = []; - int speechErrors = 0; - List errors = []; - int speechStatus = 0; - List statuses = []; - int soundLevel = 0; - List soundLevels = []; - - void onSpeechResult(SpeechRecognitionResult result) { - ++speechResults; - results.add(result); - } - - void onSpeechError(SpeechRecognitionError errorResult) { - ++speechErrors; - errors.add(errorResult); - } - - void onSpeechStatus(String status) { - ++speechStatus; - statuses.add(status); - } - - void onSoundLevel(double level) { - ++soundLevel; - soundLevels.add(level); - } -} diff --git a/speech_to_text/test/test_speech_channel_handler.dart b/speech_to_text/test/test_speech_channel_handler.dart deleted file mode 100644 index a55f0670..00000000 --- a/speech_to_text/test/test_speech_channel_handler.dart +++ /dev/null @@ -1,134 +0,0 @@ -import 'package:flutter/services.dart'; -import 'package:speech_to_text/speech_recognition_error.dart'; -import 'package:speech_to_text/speech_recognition_result.dart'; -import 'package:speech_to_text/speech_to_text.dart'; - -/// Holds a set of responses and acts as a mock for the platform specific -/// implementations allowing test cases to determine what the result of -/// a call should be. -class TestSpeechChannelHandler { - final SpeechToText _speech; - - bool listenException = false; - - static const String listenExceptionCode = "listenFailedError"; - static const String listenExceptionMessage = "Failed"; - static const String listenExceptionDetails = "Device Listen Failure"; - - TestSpeechChannelHandler(this._speech); - - bool initResult = true; - bool initInvoked = false; - bool listenInvoked = false; - bool cancelInvoked = false; - bool stopInvoked = false; - bool localesInvoked = false; - bool hasPermissionResult = true; - String listeningStatusResponse = SpeechToText.listeningStatus; - String listenLocale; - List locales = []; - static const String localeId1 = "en_US"; - static const String localeId2 = "fr_CA"; - static const String name1 = "English US"; - static const String name2 = "French Canada"; - static const String locale1 = "$localeId1:$name1"; - static const String locale2 = "$localeId2:$name2"; - static const String firstRecognizedWords = 'hello'; - static const String secondRecognizedWords = 'hello there'; - static const double firstConfidence = 0.85; - static const double secondConfidence = 0.62; - static const String firstRecognizedJson = - '{"alternates":[{"recognizedWords":"$firstRecognizedWords","confidence":$firstConfidence}],"finalResult":false}'; - static const String secondRecognizedJson = - '{"alternates":[{"recognizedWords":"$secondRecognizedWords","confidence":$secondConfidence}],"finalResult":false}'; - static const String finalRecognizedJson = - '{"alternates":[{"recognizedWords":"$secondRecognizedWords","confidence":$secondConfidence}],"finalResult":true}'; - static const SpeechRecognitionWords firstWords = - SpeechRecognitionWords(firstRecognizedWords, firstConfidence); - static const SpeechRecognitionWords secondWords = - SpeechRecognitionWords(secondRecognizedWords, secondConfidence); - static final SpeechRecognitionResult firstRecognizedResult = - SpeechRecognitionResult([firstWords], false); - static final SpeechRecognitionResult secondRecognizedResult = - SpeechRecognitionResult([secondWords], false); - static final SpeechRecognitionResult finalRecognizedResult = - SpeechRecognitionResult([secondWords], true); - static const String transientErrorJson = - '{"errorMsg":"network","permanent":false}'; - static const String permanentErrorJson = - '{"errorMsg":"network","permanent":true}'; - static final SpeechRecognitionError firstError = - SpeechRecognitionError("network", true); - static const double level1 = 0.5; - static const double level2 = 10; - - Future methodCallHandler(MethodCall methodCall) async { - switch (methodCall.method) { - case "has_permission": - return hasPermissionResult; - break; - case "initialize": - initInvoked = true; - return initResult; - break; - case "cancel": - cancelInvoked = true; - return true; - break; - case "stop": - stopInvoked = true; - return true; - break; - case SpeechToText.listenMethod: - listenInvoked = true; - if (listenException) { - throw PlatformException( - code: listenExceptionCode, - message: listenExceptionMessage, - details: listenExceptionDetails); - } - listenLocale = methodCall.arguments["localeId"]; - await _speech.processMethodCall(MethodCall( - SpeechToText.notifyStatusMethod, listeningStatusResponse)); - return initResult; - break; - case "locales": - localesInvoked = true; - return locales; - break; - default: - } - return initResult; - } - - void notifyFinalWords() { - _speech.processMethodCall( - MethodCall(SpeechToText.textRecognitionMethod, finalRecognizedJson)); - } - - void notifyPartialWords() { - _speech.processMethodCall( - MethodCall(SpeechToText.textRecognitionMethod, firstRecognizedJson)); - } - - void notifyPermanentError() { - _speech.processMethodCall( - MethodCall(SpeechToText.notifyErrorMethod, permanentErrorJson)); - } - - void notifyTransientError() { - _speech.processMethodCall( - MethodCall(SpeechToText.notifyErrorMethod, transientErrorJson)); - } - - void notifySoundLevel() { - _speech.processMethodCall( - MethodCall(SpeechToText.soundLevelChangeMethod, level2)); - } - - void setupLocales() { - locales.clear(); - locales.add(locale1); - locales.add(locale2); - } -} diff --git a/speech_to_text/test/test_speech_listener.dart b/speech_to_text/test/test_speech_listener.dart deleted file mode 100644 index 1efcd81c..00000000 --- a/speech_to_text/test/test_speech_listener.dart +++ /dev/null @@ -1,36 +0,0 @@ -import 'package:speech_to_text/speech_recognition_error.dart'; -import 'package:speech_to_text/speech_recognition_result.dart'; -import 'package:speech_to_text/speech_to_text_provider.dart'; - -/// Holds the results of notification by the [SpeechToTextProvider] -class TestSpeechListener { - final SpeechToTextProvider _speechProvider; - - bool isListening = false; - bool isFinal = false; - bool isAvailable = false; - bool notified = false; - bool hasError = false; - SpeechRecognitionResult recognitionResult; - SpeechRecognitionError lastError; - double soundLevel; - - TestSpeechListener(this._speechProvider); - - void reset() { - isListening = false; - isFinal = false; - isAvailable = false; - notified = false; - } - - void onNotify() { - notified = true; - isAvailable = _speechProvider.isAvailable; - isListening = _speechProvider.isListening; - recognitionResult = _speechProvider.lastResult; - hasError = _speechProvider.hasError; - lastError = _speechProvider.lastError; - soundLevel = _speechProvider.lastLevel; - } -}