-
카테고리
-
세부 분야
모바일 앱 개발
-
해결 여부
해결됨
빌드가 안됩니다.
22.09.12 16:47 작성 조회수 633
1
Error: Cannot run with sound null safety, because the following dependencies
don't support null safety:
- package:provider
For solutions, see https://dart.dev/go/unsound-null-safety
/D:/flutter%20sdk/flutter/.pub-cache/hosted/pub.dartlang.org/provider-3.2.0/lib/src/delegate_widget.dart:194:18: Error: Superclass has no method named 'inheritFromElement'.
return super.inheritFromElement(ancestor, aspect: aspect); ^^^^^^^^^^^^^^^^^^
/D:/flutter%20sdk/flutter/.pub-cache/hosted/pub.dartlang.org/provider-3.2.0/lib/src/provider.dart:259:19: Error: The method 'inheritFromWidgetOfExactType' isn't defined for the class 'BuildContext'.
- 'BuildContext' is from 'package:flutter/src/widgets/framework.dart' ('/D:/flutter%20sdk/flutter/packages/flutter/lib/src/widgets/framework.dart'). package:flutter/…/widgets/framework.dart:1
Try correcting the name to the name of an existing method, or defining a method named 'inheritFromWidgetOfExactType'. ? context.inheritFromWidgetOfExactType(type) as InheritedProvider<T> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/D:/flutter%20sdk/flutter/.pub-cache/hosted/pub.dartlang.org/provider-3.2.0/lib/src/provider.dart:260:19: Error: The method 'ancestorInheritedElementForWidgetOfExactType' isn't defined for the class 'BuildContext'.
- 'BuildContext' is from 'package:flutter/src/widgets/framework.dart' ('/D:/flutter%20sdk/flutter/packages/flutter/lib/src/widgets/framework.dart'). package:flutter/…/widgets/framework.dart:1
Try correcting the name to the name of an existing method, or defining a method named 'ancestorInheritedElementForWidgetOfExactType'. : context.ancestorInheritedElementForWidgetOfExactType(type)?.widget ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
답변을 작성해보세요.
2
DevStory
지식공유자2022.09.12
앗 답변을 달고 있는 사이에 해결하셨군요.
pub add로 끌고오는 버전의 기준은 pubspec.yaml 파일에 명시된 버전을 따릅니다.
provider: 3.0.2 ← 3.0.2 고정
provider: ^3.0.2 ← 3.0.2 <= 3.0.2 < 4.x.x
사용하는 패키지들이 pubspec.yaml 파일에 명시되지 않은 다른 패키지에 의존성이 있는 경우, 해당 버전은 pubspec.lock 파일에서 확인하실 수 있습니다.
감사합니다 :)
2
DevStory
지식공유자2022.09.12
안녕하세요 이종훈님
만약 Android apk 빌드를 수행이 안되셨다면 아래 명령어로 빌드를 진행해 주세요.
flutter build apk --no-sound-null-safety
위 명령어로 문제 해결이 안되셨다면 다음 내용 부탁드립니다.
전체 소스 코드
flutter doctor 수행 결과
문제 재현 방법(예를 들어, 수행하신 빌드 명령어)
오픈 카카오톡으로 답변 주시면 보다 신속한 답변을 받으실 수 있음을 알려드립니다.
감사합니다 ❤️
1
이종훈
질문자2022.09.12
해결했습니다. vs code folder trust 설정 문제와 provider 버전문제가 잇었습니다.
pub add로 끌고오는 버전의 기준이 뭔지 모르겠습니다.
답변 3