函数 'assessmentSink' 无法返回类型 'StreamSink<dynamic>' 的值

A value of type 'StreamSink<dynamic>' can't be returned from the function 'assessmentSink'

class AssessmentBloc {


  late AssessmentRepository _genRepository;

  late StreamController assessmentController;
  late StreamController submitAssessmentController;


  StreamSink<ApiResponse<AssessmentModel>> get assessmentSink => assessmentController.sink;
  StreamSink<ApiResponse<AssessmentResult>> get submitSink => submitAssessmentController.sink;


  AssessmentBloc() {
    assessmentController = StreamController<ApiResponse<AssessmentModel>>();
    submitAssessmentController = StreamController<ApiResponse<AssessmentResult>>();

    _genRepository = AssessmentRepository();
  }




  dispose() {
    assessmentController?.close();
    submitAssessmentController?.close();
  }
}



 class ApiResponse<T> {
  States state;

  T? data;

  String? message;
  bool? status;

  ApiResponse.loading(this.message) : state = States.LOADING;

  ApiResponse.completed(this.data) : state = States.COMPLETED;
  //ApiResponse.completedWithMsg(this.message) : state = States.COMPLETED;
  ApiResponse.completedWithMsg({this.status, this.message}) : state = States.COMPLETED_WITH_MSG;

  ApiResponse.error(this.message) : state = States.ERROR;
  ApiResponse.reset() : state = States.RESET;

  @override
  String toString() {
    return "States : $state \n Message : $message \n Data : $data";
  }
}

枚举状态 { 加载、完成、COMPLETED_WITH_MSG、错误、重置}

刚刚将代码迁移到 null-safety dart 版本 2.12,此行出现错误。以前的版本 2.7.0 运行良好。如果你们中的任何人能帮助我,我将不胜感激。

A value of type 'StreamSink<dynamic>' can't be returned from the function 'assessmentSink' because it has a return type of 'StreamSink<ApiResponse<AssessmentModel>>'.

尝试将流控制器的类型定义为:

late StreamController<ApiResponse<AssessmentModel>> submitAssessmentController;