import 'dart:async'; import 'package:zhiying_comm/zhiying_comm.dart'; import 'package:zhiying_comm/util/base_bloc.dart'; class MainPageBloc extends BlocBase { List>> _mains = List(); StreamController>>> _mainController = StreamController>>>(); Stream>>> get outData => _mainController.stream; @override void dispose() { _mainController.close(); _mainController = null; } void loadData(List ids) { NetUtil.request('/api/v1/mod', method: NetMethod.POST, params: Map.from({'ids': ids}), onSuccess: (data) { Map datas = data; List>> result = List(); for (int id in ids) { if (datas.containsKey(id.toString())) { result.add(List>.from(datas[id.toString()])); } else { result.add(List>()); } } _mains = result; _mainController.add(_mains); }); } }