import 'dart:async'; import 'package:zhiying_comm/util/base_bloc.dart'; import 'package:zhiying_comm/zhiying_comm.dart'; class HomePageBloc extends BlocBase { List> _tabs = List(); StreamController>> _tabController = StreamController>>(); Stream>> get outData => _tabController.stream; @override void dispose() { _tabController.close(); _tabController = null; } void refresh() { NetUtil.request('/api/v1/config.json', onCache: (data) { _refresh(data); }, onSuccess: (data) { _refresh(data); }); } void _refresh(dynamic data) { List list = data; _tabs = list.map((item) { return Map.from(item); }).toList(); _tabController.add(_tabs); } }