flutterchina / flutter_in_action_2nd

《Flutter实战 第二版》 书稿
https://book.flutterchina.club/
2.18k stars 345 forks source link

最后的实例中,代码出现了很多小问题 #114

Open bewaternow opened 2 years ago

bewaternow commented 2 years ago
Git([this.context]) {
    _options = Options(extra: {"context": context});
}

The parameter 'context' can't have a value of 'null' because of its type, but the implicit default value is 'null'.

options: _options.merge(headers: {
    HttpHeaders.authorizationHeader: basic
}, extra: {
    "noCache": true, //本接口禁用缓存
}),

Dio The method 'merge' isn't defined for the type 'Options'

我是初学者,所以对于书中的问题,通常不敢轻易论断。

shixueqian commented 2 years ago

merge好像方法找不到了。我使用copyWith方法代替的,可以跑起来

songxing10000 commented 2 years ago

初学者,折腾了很久, 抓包没效果。

Git([this.context]) {
    _options = Options(extra: {"context": context});

  // 居然这里要手动加上下面的代码才能在Charles里抓包
  init();
}