scheme method

String scheme(
  1. String remote,
  2. String? forwardedProto
)

https when a trusted proxy says the client used https

Implementation

String scheme(String remote, String? forwardedProto) {
  if (forwardedProto == null || !trusts(remote)) return 'http';
  String proto = forwardedProto.split(',').first.trim().toLowerCase();
  return proto == 'https' ? 'https' : 'http';
}