S
Size: a a a
S
S
НК
🅵
import 'dart:io' as io;
String get flutter => io.Platform.isWindows
? r'flutter.bat'
: r'flutter';
@Task('Upgrade flutter')
Future<void> upgrade() async => logProcessOutput(
flutter,
arguments: <String>['upgrade'],
);
Future<void> logProcessOutput(String executable,
{List<String> arguments}) async {
final io.Process process = await io.Process.start(
executable,
arguments,
);
//final bool ansi = io.stdout.supportsAnsiEscapes;
Completer<void> completer = Completer<void>();
StreamSubscription<List<int>> onSuccess = process.stdout.listen((message) {
io.stdout.write('${utf8.decode(message)}');
}, onDone: () => completer.complete());
StreamSubscription<List<int>> onError = process.stderr.listen((message) {
io.stdout.write('\x1B[31m${utf8.decode(message)}\x1B[0m');
}, onDone: () => completer.complete());
return completer.future.then(
(_) => Future.wait<void>([
onSuccess.cancel(),
onError.cancel(),
]),
);
}
T
ГК
T
RC
class NetworkManager {
Dio _dio;
RestClient _restClient;
bool _isInit = false;
DioOptions dioOptions = DioOptions();
static final NetworkManager _singleton = NetworkManager._internal();
factory NetworkManager() {
return _singleton;
}
NetworkManager._internal();
RestClient get restClient => _isInit ? _restClient : _initRestClient();
_initDio() async {
SharedPreference sharedPreference = SharedPreference();
_dio = new Dio(
dioOptions.setBasicOptions(await sharedPreference.getSessionInfo()));
}
RestClient _initRestClient() {
_initDio();
_restClient = RestClient(_dio);
_isInit=true;
}
}
RC
🅵
class NetworkManager {
Dio _dio;
RestClient _restClient;
bool _isInit = false;
DioOptions dioOptions = DioOptions();
static final NetworkManager _singleton = NetworkManager._internal();
factory NetworkManager() {
return _singleton;
}
NetworkManager._internal();
RestClient get restClient => _isInit ? _restClient : _initRestClient();
_initDio() async {
SharedPreference sharedPreference = SharedPreference();
_dio = new Dio(
dioOptions.setBasicOptions(await sharedPreference.getSessionInfo()));
}
RestClient _initRestClient() {
_initDio();
_restClient = RestClient(_dio);
_isInit=true;
}
}
🅵
🅵
DO
🅵
RC
RC
🅵
RC
RC
🅵