The instance member 'widget' can't be accessed in an initializer. code example

Example: The instance member 'data' can't be accessed in an initializer.

you can use the getter methods that can access these class objects inside the 
methods.

class AppTheme {
  final Color blueColorHexCode = Color(0xff3d63ff);
	
  //App Bar Text
  TextTheme get appBarTextTheme {
  	 return TextTheme(
      headline1: GoogleFonts.ibmPlexSans(
          textStyle: TextStyle(color: grayColorHexCode),
		),
	);
  }
  
  ........................
  ............................
}

Tags:

Misc Example