[Flutter]modal bottom sheet 패키지 에러 해결 기록

한상욱·2023년 8월 15일
0

에러해결모음

목록 보기
2/10
post-thumbnail

사건의 발단

pub.dev 사이트에 modal_bottom_sheet 패키지가 있습니다.

이거 사용하려고 패키지를 받았더니 이런화면이 등장합니다...

: Error: 'ModalBottomSheetRoute' is imported from both 'package:flutter/src/material/bottom_sheet.dart' and 'package:modal_bottom_sheet/src/bottom_sheet_route.dart'.
../…/bottom_sheets/bar_bottom_sheet.dart:102
      .push(ModalBottomSheetRoute<T>(
            ^^^^^^^^^^^^^^^^^^^^^

: Error: A value of type 'Object?' can't be returned from an async function with return type 'Future<T?>'.
../…/bottom_sheets/bar_bottom_sheet.dart:125
 - 'Object' is from 'dart:core'.
 - 'Future' is from 'dart:async'.
  return result;
         ^

버전 호환 에러

구글링을 하다가 현재 플러터 버전과 라이브러리의 버전이 호환되지 않아 에러가 발생했다는 것을 알게되었고, 해결책을 발견했습니다.

dependency_overrides:
  modal_bottom_sheet: ^3.0.0-pre

이 내용을 pubspec.yaml 파일에 추가하면 에러를 해결할 수 있습니다.

결론

버전이 맞지 않는 라이브러리는 에러가 발생할 수 있습니다.

profile
자기주도적, 지속 성장하는 모바일앱 개발자의 기록

0개의 댓글