My project was working fine with version 1.10.0, I have upgraded flutter to new version 1.12 and I am getting the below error
Compiler message:
../../../AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/flutter_platform_widgets-0.20.2/lib/src/platform_scaffold.dart:229:38: Error: The getter 'fullObstruction' isn't defined for the class 'ObstructingPreferredSizeWidget'.
- 'ObstructingPreferredSizeWidget' is from 'package:flutter/src/cupertino/page_scaffold.dart' ('/C:/src/flutter/packages/flutter/lib/src/cupertino/page_scaffold.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'fullObstruction'.
final obstruct = navigationBar.fullObstruction == null ||
^^^^^^^^^^^^^^^
../../../AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/flutter_platform_widgets-0.20.2/lib/src/platform_scaffold.dart:230:25: Error: The getter 'fullObstruction' isn't defined for the class 'ObstructingPreferredSizeWidget'.
- 'ObstructingPreferredSizeWidget' is from 'package:flutter/src/cupertino/page_scaffold.dart' ('/C:/src/flutter/packages/flutter/lib/src/cupertino/page_scaffold.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'fullObstruction'.
navigationBar.fullObstruction;
^^^^^^^^^^^^^^^
Target kernel_snapshot failed: Exception: Errors during snapshot creation: null build failed.
Degrading the flutter to 1.10 again the project is working fine, but I need to upgrade to this 1.12 version for webrtc library. Can somebody help to solve this issue?
For those who come across this issue, I am here with a solution. This issue took my 2 days and I was banging my head, why flutter package showing error eventhough I upgraded to the stable version of flutter v1.12.13+hotfix.5-stable.zip
Solution: The issue above saying that fullObstruction is not defined for the class ObstructingPreferredSizeWidget which is in the file CupertinoPageScaffold.dart. So I took the file in the notepad which is in the flutter package. The original path is C:\src2\flutter\packages\flutter\lib\src\cupertino , src2 is the folder where my flutter package resides.
In that file I saw a variable is changed in the newer versions, instead of below variable earlier it was fullObstruction, they changed to bool shouldFullyObstruct(BuildContext context); in newer versions.
abstract class ObstructingPreferredSizeWidget extends PreferredSizeWidget {
/// If true, this widget fully obstructs widgets behind it by the specified
/// size.
///
/// If false, this widget partially obstructs.
bool shouldFullyObstruct(BuildContext context);
}
Then I check which file this error is occuring, C:\src2\flutter.pub-cache\hosted\pub.dartlang.org\flutter_platform_widgets-0.20.2\lib\src\platform-scaffold.dart
earlier this line is using the deprecated variable fullObstruction, I replaced with the new variable and issue solved and my project is working as fine as earlier.
final obstruct = navigationBar.shouldFullyObstruct(context) == null || navigationBar.shouldFullyObstruct(context);
Hope this helps somebody.