decode method
Ingests value
into the properties of this type.
Override this method to provide decoding behavior other than the default behavior.
Implementation
@override
void decode(dynamic value) {
if (value is Map) {
super.decode(value);
return;
}
if (value is! String) {
throw ConfigurationException(this,
"'${value.runtimeType}' is not assignable; must be a object or string");
}
var uri = Uri.parse(value.toString());
host = uri.host;
port = uri.port;
if (uri.pathSegments.length == 1) {
databaseName = uri.pathSegments.first;
}
if (uri.userInfo == '') {
validate();
return;
}
var authority = uri.userInfo.split(":");
// if (authority != null) {
if (authority.isNotEmpty) {
username = Uri.decodeComponent(authority.first);
}
if (authority.length > 1) {
password = Uri.decodeComponent(authority.last);
}
// }
validate();
}