我是新的飞镖/颤振程序员。我正在尝试理解工具,扩展和使用之间的区别。
例如,可以通过使用“ with”将逻辑类绑定到状态吗?
class Home extends StatefulWidget {
@override
_HomeState createState() => _HomeState();
}
class _HomeState extends State<Home> with HomeLogic //homelogic is a class for DB connection and logic things{
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: Text(connectedUser) //in HomeLogic I have connectedUser string,
),
);
}
}