'The argument type 'BoxConstraints' can't be assigned to the parameter type 'BuildContext'
I Hello, I need help in my code, why I am getting this error, I copied the code from another project but there is no error there.
@override
Widget build(BuildContext context) {
dynamic screenWidth = MediaQuery.of(context).size.width;
dynamic screenHeight = MediaQuery.of(context).size.height;
ScreenUtil.init(
BoxConstraints(maxWidth: screenWidth, maxHeight: screenHeight),
designSize: const Size(360, 690),
orientation: Orientation.portrait);
return Scaffold(
Solution 1:[1]
ScreenUtil.init's 1st argument is of type BuildContext.
ScreenUtil.init(
context,
deviceSize: Size(screenWidth, screenHeight),
designSize: const Size(360, 690),
orientation: Orientation.portrait,
);
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | MindStudio |

