instance static method

TrustPin instance(
  1. String id
)

Returns a named TrustPin instance for the given id.

Named instances allow libraries or multi-tenant apps to maintain independent pinning configurations without conflicts. Calling this method multiple times with the same id returns the same instance.

final pin = TrustPin.instance('com.mylib.networking');
await pin.setup(config);
await pin.verify('api.example.com', pem);

Implementation

static TrustPin instance(String id) {
  assert(id != 'default',
      'Use TrustPin.shared to access the default instance.');
  assert(id.trim().isNotEmpty, 'TrustPin instance id cannot be empty.');
  return _instances.putIfAbsent(id, () => TrustPin._(id));
}