老师,我把翻译加到Provider那个例子里面报错了,请看看是怎么回事呢
body: Consumer2<CounterModel, double>(
//builder函数可以直接获取到counter参数
builder: (context, CounterModel counter, double textSize, _) =>
Text(S.of(context).message_tip(counter.counter.toString()), style: TextStyle(fontSize: textSize))),
错误信息是:The method 'message_tip' was called on null.
展开
作者回复: builder里是没法用的,因为context得要找到_localizationsScope,你换一个实现方式