I am running an older Flutter project and have recently upgraded my pubspec.yaml file. It is giving a compile error.
Error: The method 'init' isn't defined for the class 'SizerUtil'
When I tried to look inside the class SizerUtil, which is a part of the library sizer and inside utils.dart, I am unable to find any init method inside it.
My Code, where I am getting the error in main.dart:
OrientationBuilder(
builder: (context,orientation){
SizerUtil().init(constraints, orientation); // this line gives error
return MaterialApp(
debugShowCheckedModeBanner: false,
theme: _appTheme(base),
initialRoute: RoutingConstants.gatewayScreen,
onGenerateRoute: RouterPage.ongenerateRoute,
);
},
);
Method init has been removed from the library and has been replaced with the setScreenMethod().
Inside class SizerUtil ->
Replace the code with this: