ServiceProvider クラス
子孫のBuildContextへ依存性注入コンテナーを公開するInheritedWidgetです。
名前空間: FloatSoda.Widgets
アセンブリ: FloatSoda.dll
public record ServiceProvider : InheritedWidget, IEquatable<Widget>, IEquatable<InheritedWidget>, IEquatable<ServiceProvider>object ← Widget ← InheritedWidget ← ServiceProvider
実装するインターフェイス
Section titled “実装するインターフェイス”IEquatable<Widget>, IEquatable<InheritedWidget>, IEquatable<ServiceProvider>
継承したメンバー
Section titled “継承したメンバー”InheritedWidget.Child, InheritedWidget.ScopeType, InheritedWidget.CreateElement(), InheritedWidget.UpdateShouldNotify(InheritedWidget), Widget.Key, Widget.CanUpdate(Widget, Widget), Widget.CreateElement(), Widget.GetHashCode(), object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()
Services
Section titled “Services”子孫からサービスを解決するときに使用する依存性注入コンテナーを取得します。
public required IServiceProvider Services { get; init; }プロパティの値
Section titled “プロパティの値”Of(IBuildContext)
Section titled “Of(IBuildContext)”最も近い祖先のServiceProviderから依存性注入コンテナーを取得し、 呼び出し元をそのInheritedWidgetの依存対象として登録します。
public static IServiceProvider Of(IBuildContext context)パラメーター
Section titled “パラメーター”context IBuildContext
サービスを要求するウィジェットのBuildContext。
最も近い祖先が公開している依存性注入コンテナー。
祖先にServiceProviderが存在しない場合にスローされます。
UpdateShouldNotify(InheritedWidget)
Section titled “UpdateShouldNotify(InheritedWidget)”依存性注入コンテナーの参照が変更され、依存するElementの再ビルドが必要かを判定します。
public override bool UpdateShouldNotify(InheritedWidget oldWidget)パラメーター
Section titled “パラメーター”oldWidget InheritedWidget
更新前のInheritedWidget。
更新前のウィジェットがServiceProviderであり、 Servicesの参照が変更された場合はtrue。 それ以外の場合はfalse。