Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Find ancestor widget of exact type fix #25

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,7 @@ pubspec.lock
# Directory created by dartdoc
# If you don't generate documentation locally you can remove this line.
doc/api/

example/ios/
example/android/
example/.dart_tool/
1 change: 1 addition & 0 deletions example/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
**/ios/Flutter/flutter_assets/
**/ios/ServiceDefinitions.json
**/ios/Runner/GeneratedPluginRegistrant.*
**/ios/Flutter/flutter_export_environment.sh

# Exceptions to above rules.
!**/ios/**/default.mode1v3
Expand Down
13 changes: 13 additions & 0 deletions example/ios/Flutter/flutter_export_environment.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/sh
# This is a generated file; do not edit or check into version control.
export "FLUTTER_ROOT=D:\flutter"
export "FLUTTER_APPLICATION_PATH=C:\Users\User\Documents\MyProjects\fmvvm\example"
export "FLUTTER_TARGET=lib\main.dart"
export "FLUTTER_BUILD_DIR=build"
export "SYMROOT=${SOURCE_ROOT}/../build\ios"
export "FLUTTER_BUILD_NAME=1.0.0"
export "FLUTTER_BUILD_NUMBER=1"
export "DART_OBFUSCATION=false"
export "TRACK_WIDGET_CREATION=false"
export "TREE_SHAKE_ICONS=false"
export "PACKAGE_CONFIG=.packages"
3 changes: 1 addition & 2 deletions lib/bindings/bindingwidget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@ class BindingWidget<T extends BindableBase> extends StatefulWidget {
/// This looks up the context for an ancestor that is a BindingWidget of the
/// supplied type. If none are found, an [ArgumentError] is raised.
static BindingWidget<T> of<T extends BindableBase>(BuildContext context) {
final type = Utilities.typeOf<BindingWidget<T>>();
final bindingWidget =
context.ancestorWidgetOfExactType(type) as BindingWidget<T>;
context.findAncestorWidgetOfExactType<BindingWidget<T>>();

if (bindingWidget == null) {
throw ArgumentError('No BindingWidgets found for the specified type.');
Expand Down