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

fix bugs generated by _steps null in discoverFeatures and _alreadyCompletedSteps methods #42

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
2 changes: 1 addition & 1 deletion example/.flutter-plugins-dependencies
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"shared_preferences","path":"/Users/ganeshr/.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.5.12/","dependencies":[]}],"android":[{"name":"shared_preferences","path":"/Users/ganeshr/.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.5.12/","dependencies":[]}],"macos":[{"name":"shared_preferences_macos","path":"/Users/ganeshr/.pub-cache/hosted/pub.dartlang.org/shared_preferences_macos-0.0.1+10/","dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"/Users/ganeshr/.pub-cache/hosted/pub.dartlang.org/path_provider_linux-0.0.1+2/","dependencies":[]},{"name":"shared_preferences_linux","path":"/Users/ganeshr/.pub-cache/hosted/pub.dartlang.org/shared_preferences_linux-0.0.2+2/","dependencies":["path_provider_linux"]}],"windows":[{"name":"path_provider_windows","path":"/Users/ganeshr/.pub-cache/hosted/pub.dartlang.org/path_provider_windows-0.0.4+1/","dependencies":[]},{"name":"shared_preferences_windows","path":"/Users/ganeshr/.pub-cache/hosted/pub.dartlang.org/shared_preferences_windows-0.0.1+1/","dependencies":["path_provider_windows"]}],"web":[{"name":"shared_preferences_web","path":"/Users/ganeshr/.pub-cache/hosted/pub.dartlang.org/shared_preferences_web-0.1.2+7/","dependencies":[]}]},"dependencyGraph":[{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_windows","dependencies":[]},{"name":"shared_preferences","dependencies":["shared_preferences_linux","shared_preferences_macos","shared_preferences_web","shared_preferences_windows"]},{"name":"shared_preferences_linux","dependencies":["path_provider_linux"]},{"name":"shared_preferences_macos","dependencies":[]},{"name":"shared_preferences_web","dependencies":[]},{"name":"shared_preferences_windows","dependencies":["path_provider_windows"]}],"date_created":"2020-10-07 20:05:17.296552","version":"1.22.0"}
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"shared_preferences","path":"/Users/ganeshr/.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.5.12/","dependencies":[]}],"android":[{"name":"shared_preferences","path":"/Users/ganeshr/.pub-cache/hosted/pub.dartlang.org/shared_preferences-0.5.12/","dependencies":[]}],"macos":[{"name":"shared_preferences_macos","path":"/Users/ganeshr/.pub-cache/hosted/pub.dartlang.org/shared_preferences_macos-0.0.1+10/","dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"/Users/ganeshr/.pub-cache/hosted/pub.dartlang.org/path_provider_linux-0.0.1+2/","dependencies":[]},{"name":"shared_preferences_linux","path":"/Users/ganeshr/.pub-cache/hosted/pub.dartlang.org/shared_preferences_linux-0.0.2+2/","dependencies":["path_provider_linux"]}],"windows":[{"name":"path_provider_windows","path":"/Users/ganeshr/.pub-cache/hosted/pub.dartlang.org/path_provider_windows-0.0.4+1/","dependencies":[]},{"name":"shared_preferences_windows","path":"/Users/ganeshr/.pub-cache/hosted/pub.dartlang.org/shared_preferences_windows-0.0.1+1/","dependencies":["path_provider_windows"]}],"web":[{"name":"shared_preferences_web","path":"/Users/ganeshr/.pub-cache/hosted/pub.dartlang.org/shared_preferences_web-0.1.2+7/","dependencies":[]}]},"dependencyGraph":[{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_windows","dependencies":[]},{"name":"shared_preferences","dependencies":["shared_preferences_linux","shared_preferences_macos","shared_preferences_web","shared_preferences_windows"]},{"name":"shared_preferences_linux","dependencies":["path_provider_linux"]},{"name":"shared_preferences_macos","dependencies":[]},{"name":"shared_preferences_web","dependencies":[]},{"name":"shared_preferences_windows","dependencies":["path_provider_windows"]}],"date_created":"2020-10-07 20:05:17.296552","version":"1.22.0"}
1 change: 1 addition & 0 deletions example/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
**/doc/api/
.dart_tool/
.flutter-plugins
.flutter-plugins-dependencies
.packages
.metadata
.pub-cache/
Expand Down
6 changes: 2 additions & 4 deletions lib/src/foundation/bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class Bloc {

_steps = steps;
_stepsToIgnore = await _alreadyCompletedSteps;
_steps = _steps.where((s) => !_stepsToIgnore.contains(s)).toList();
_steps = _steps?.where((s) => !_stepsToIgnore.contains(s))?.toList() ?? [];
_activeStepIndex = -1;

await _nextStep();
Expand Down Expand Up @@ -156,9 +156,7 @@ class Bloc {
Future<Set<String>> get _alreadyCompletedSteps async {
if (!recordInSharedPrefs) return {};
final prefs = await SharedPreferences.getInstance();
return _steps
.where((s) => prefs.getBool('$sharedPrefsPrefix$s') == true)
.toSet();
return _steps?.where((s) => prefs.getBool('$sharedPrefsPrefix$s') == true)?.toSet() ?? {};
}

/// Returns true iff this step has been previously
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: >-
A Flutter package that implements Material Design Feature discovery
to show a description of specific features to new users.
See https://tinyurl.com/FeatureDiscovery
version: 0.12.0+2
version: 0.12.1+3
homepage: https://github.com/ayalma/feature_discovery

environment:
Expand Down