using Unity.UIWidgets.foundation; using Unity.UIWidgets.widgets; namespace UIWidgetsSample { public class InheritedL10n : InheritedWidget { /// Represents localized copy public readonly ChatL10n l10n; /// Creates [InheritedWidget] from a provided [ChatL10n] class public InheritedL10n( ChatL10n l10n, Widget child, Key key = null ) : base(key, child) { this.l10n = l10n; } public static InheritedL10n of(BuildContext context) { return context.dependOnInheritedWidgetOfExactType(); } public override bool updateShouldNotify(InheritedWidget oldWidget) { var test = ((InheritedL10n) oldWidget).l10n; return l10n.GetHashCode() != ((InheritedL10n) oldWidget).l10n?.GetHashCode(); } } }