Onvif constructor Null safety

Onvif(
  1. {required String host,
  2. required String username,
  3. required String password,
  4. required LogOptions logOptions,
  5. required LoggyPrinter printer}
)

Implementation

Onvif(
    {required this.host,
    required this.username,
    required this.password,
    required LogOptions logOptions,
    required LoggyPrinter printer})
    : _hostUri = (host.startsWith('http') ? host : 'http://$host').parseUri {
  Loggy.initLoggy(logPrinter: printer, logOptions: logOptions);

  final dio = Dio();

  dio.interceptors.add(InterceptorsWrapper(onRequest: (options, handler) {
    loggy.debug('URI: ${options.uri}');

    loggy.debug('REQUEST:\n${options.data}');

    return handler.next(options); //continue
  }, onResponse: (response, handler) {
    loggy.debug('RESPONSE:\n${response.data}');

    return handler.next(response); // continue
  }, onError: (DioError e, handler) {
    loggy.error('ERROR:\n$e');

    return handler.next(e); //continue
  }));

  Soap.dio = dio;

  _deviceServiceUri = '${_hostUri.origin}/onvif/device_service'.parseUri;

  deviceManagement = DeviceManagement(onvif: this, uri: _deviceServiceUri);
}