我在 dart 中找到了将普通字符串转换为驼峰式大小写和蛇式大小写的方法,但我想将 SnakeCase 实现为普通句子。
例如:myNameIsJohnDoe到我的名字是 john doe
我在 Stateful 类中声明了一个回调方法,例如:
final void Function(int index)? onSelected;
MyBottomNavigationBar({@required this.onSelected});
Run Code Online (Sandbox Code Playgroud)
并在 state 类中使用widget.onselected调用,例如:
widget.onSelected!(_selectedIndex);
Run Code Online (Sandbox Code Playgroud)
但我无法理解! 砰运算符。我不能在没有给出的情况下在构造函数中初始化 widget.onSelected ?申报期间。
我的主要问题是“如何! bang 运算符处理空值?它有什么用?