From f00f651883467efe553b651ef2f49854422a8d30 Mon Sep 17 00:00:00 2001 From: Duncan Babbage Date: Tue, 23 Jan 2024 11:10:49 +1300 Subject: [PATCH 1/2] Do not crash when nullable actions is null Actions was made nullable in d93e351f4095d30a436fbf6ec3e3dc224e7905a1 but that same commit introduced a non-null assertion operator here which means it is valid to create a `KeyboardActionsConfig` with a null `actions` but this will crash `KeyboardActions` on init. This commit ensures that we check if there are actions on the newConfig and only attempt to iterate over them when they exist. By assigning newConfig.actions to a local variable it is implicitly unwrapped once the null check has occurred. --- lib/keyboard_actions.dart | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/keyboard_actions.dart b/lib/keyboard_actions.dart index 180b2df..8548a98 100644 --- a/lib/keyboard_actions.dart +++ b/lib/keyboard_actions.dart @@ -170,8 +170,11 @@ class KeyboardActionstate extends State void setConfig(KeyboardActionsConfig newConfig) { clearConfig(); config = newConfig; - for (int i = 0; i < config!.actions!.length; i++) { - _addAction(i, config!.actions![i]); + final newActions = newConfig.actions; + if (newActions != null) { + for (int i = 0; i < newActions.length; i++) { + _addAction(i, newActions[i]); + } } _startListeningFocus(); } From 3284a111175f17aea19a72c5b0248354b22119a8 Mon Sep 17 00:00:00 2001 From: Duncan Babbage Date: Tue, 23 Jan 2024 11:02:56 +1300 Subject: [PATCH 2/2] Remove flutter_export_environment from repo This is a generated file that is not intended to be checked into version control. It is deleted here to remove it from the repo and added to `.gitignore` but will be re-generated locally (and ignored from source control) as each developer builds the project. --- .gitignore | 1 + ios/Flutter/flutter_export_environment.sh | 13 ------------- 2 files changed, 1 insertion(+), 13 deletions(-) delete mode 100755 ios/Flutter/flutter_export_environment.sh diff --git a/.gitignore b/.gitignore index af3d2d1..87af008 100644 --- a/.gitignore +++ b/.gitignore @@ -42,3 +42,4 @@ example/ios/Flutter/Flutter.podspec example/ios/Flutter/.last_build_id .fvm/flutter_sdk .fvm/fvm_config.json +flutter_export_environment.sh diff --git a/ios/Flutter/flutter_export_environment.sh b/ios/Flutter/flutter_export_environment.sh deleted file mode 100755 index 2a44c3c..0000000 --- a/ios/Flutter/flutter_export_environment.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh -# This is a generated file; do not edit or check into version control. -export "FLUTTER_ROOT=/Users/diego/fvm/versions/3.7.3" -export "FLUTTER_APPLICATION_PATH=/Users/diego/Development/workspaces/flutter/flutter_keyboard_actions" -export "COCOAPODS_PARALLEL_CODE_SIGN=true" -export "FLUTTER_TARGET=lib/main.dart" -export "FLUTTER_BUILD_DIR=build" -export "FLUTTER_BUILD_NAME=4.1.1" -export "FLUTTER_BUILD_NUMBER=4.1.1" -export "DART_OBFUSCATION=false" -export "TRACK_WIDGET_CREATION=true" -export "TREE_SHAKE_ICONS=false" -export "PACKAGE_CONFIG=.dart_tool/package_config.json"