2020/12/20 : InheritedWidgetのソースの解説の訳

 

 

abstract class InheritedWidget extends ProxyWidget {
  /// Abstract const constructor. This constructor enables subclasses to provide
  /// const constructors so that they can be used in const expressions.
  const InheritedWidget({ Key key, Widget child })
    : super(key: key, child: child);

  @override
  InheritedElement createElement() => InheritedElement(this);


  /// Whether the framework should notify widgets that inherit from this widget.
フレームワークが、このウィジェット(InheritedWidget、そのサブクラス)のchildに対して通知をするべきかどうか。
  ///
  /// When this widget is rebuilt, sometimes we need to rebuild the widgets that
  /// inherit from this widget but sometimes we do not.
このウィジェット(InheritedWidget、そのサブクラス)がリビルドされる時、時に私たちはchildもリビルドされて欲しい、しかしchildはリビルドされて欲しくない場合もある。
 For example, if the data
  /// held by this widget is the same as the data held by `oldWidget`, then we
  /// do not need to rebuild the widgets that inherited the data held by
  /// `oldWidget`.
例えば、「InheritedWidget、あるいはそのサブクラス」が保持しているデータが、「'oldWidget'の保持しているデータ」と同じデータを保持している時、
  ///
  /// The framework distinguishes these cases by calling this function with the
  /// widget that previously occupied this location in the tree as an argument.
  /// The given widget is guaranteed to have the same [runtimeType] as this
  /// object.
  @protected
  bool updateShouldNotify(covariant InheritedWidget oldWidget);
}

 

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です