scheme method
https when a trusted proxy says the client used https. With no
word from a trusted proxy: direct, the scheme of the port (default
directScheme).
Implementation
String scheme(String remote, String? forwardedProto, [String? direct]) {
if (forwardedProto == null || !trusts(remote)) {
return direct ?? directScheme;
}
String proto = forwardedProto.split(',').first.trim().toLowerCase();
return proto == 'https' ? 'https' : 'http';
}