해결된 질문
작성
·
916
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 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
답변 3
2
앗 답변을 달고 있는 사이에 해결하셨군요.
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 파일에서 확인하실 수 있습니다.
감사합니다 :)
1