/// Signature for the `buildWhen` function which takes the previous `state` and/// the current `state` and is responsible for returning a [bool] which/// determines whether to rebuild [BlocBuilder] with the current `state`.typedef BlocBuilderCondition<S> = bool Function(S previous, S current);大致意思就是该方法返回两个state,根据之前的state和 当前的state来判断是否必要革新当前的widget,看到这里这种场景就很好实现了。代码如下:Demo
buildWhen: (previous, current) { if (type == 1) { return previous.phoneNumber != current.phoneNumber; } else { return previous.codeNumber != current.codeNumber; } },