整理
This commit is contained in:
parent
d12244f1d3
commit
c61a111ef2
@ -42,33 +42,30 @@ class Home extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _HomeState extends State<Home> {
|
||||
late final StreamSubscription<WeiboAuthResp> _auth =
|
||||
Weibo.instance.authResp().listen(_listenAuth);
|
||||
late final StreamSubscription<WeiboSdkResp> _share =
|
||||
Weibo.instance.shareMsgResp().listen(_listenShareMsg);
|
||||
late final StreamSubscription<BaseResp> _respSubs =
|
||||
Weibo.instance.respStream().listen(_listenResp);
|
||||
|
||||
WeiboAuthResp? _authResp;
|
||||
AuthResp? _authResp;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
}
|
||||
|
||||
void _listenAuth(WeiboAuthResp resp) {
|
||||
void _listenResp(BaseResp resp) {
|
||||
if (resp is AuthResp) {
|
||||
_authResp = resp;
|
||||
final String content = 'auth: ${resp.errorCode}';
|
||||
_showTips('登录', content);
|
||||
}
|
||||
|
||||
void _listenShareMsg(WeiboSdkResp resp) {
|
||||
} else if (resp is ShareMsgResp) {
|
||||
final String content = 'share: ${resp.errorCode}';
|
||||
_showTips('分享', content);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_auth.cancel();
|
||||
_share.cancel();
|
||||
_respSubs.cancel();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
|
@ -82,4 +82,3 @@ class WeiboUserInfoResp extends WeiboApiResp {
|
||||
|
||||
Map<String, dynamic> toJson() => _$WeiboUserInfoRespToJson(this);
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,6 @@ import 'package:weibo_kit/weibo_kit.dart';
|
||||
import 'package:weibo_kit_example/model/weibo_api_resp.dart';
|
||||
|
||||
extension ApiWeibo on Weibo {
|
||||
|
||||
/// 用户信息
|
||||
Future<WeiboUserInfoResp> getUserInfo({
|
||||
required String appkey,
|
||||
|
Loading…
Reference in New Issue
Block a user