implement static method
NSCollectionLayoutContainer
implement({
- required CGSize contentSize(),
- required CGSize effectiveContentSize(),
- required NSDirectionalEdgeInsets contentInsets(),
- required NSDirectionalEdgeInsets effectiveContentInsets(),
- bool $keepIsolateAlive = true,
Builds an object that implements the NSCollectionLayoutContainer protocol. To implement
multiple protocols, use addToBuilder or objc.ObjCProtocolBuilder directly.
If $keepIsolateAlive is true, this protocol will keep this isolate
alive until it is garbage collected by both Dart and ObjC.
Implementation
static NSCollectionLayoutContainer implement({
required NSSize Function() contentSize,
required NSSize Function() effectiveContentSize,
required NSDirectionalEdgeInsets Function() contentInsets,
required NSDirectionalEdgeInsets Function() effectiveContentInsets,
bool $keepIsolateAlive = true,
}) {
final builder = objc.ObjCProtocolBuilder(
debugName: 'NSCollectionLayoutContainer',
);
NSCollectionLayoutContainer.contentSize.implement(builder, contentSize);
NSCollectionLayoutContainer.effectiveContentSize.implement(
builder,
effectiveContentSize,
);
NSCollectionLayoutContainer.contentInsets.implement(builder, contentInsets);
NSCollectionLayoutContainer.effectiveContentInsets.implement(
builder,
effectiveContentInsets,
);
builder.addProtocol($protocol);
return NSCollectionLayoutContainer.castFrom(
builder.build(keepIsolateAlive: $keepIsolateAlive),
);
}