tekartik / app_flutter_utils.dart Goto Github PK
View Code? Open in Web Editor NEWFlutter utilities
License: BSD 2-Clause "Simplified" License
Flutter utilities
License: BSD 2-Clause "Simplified" License
Today I was getting the following error when calling getDatabaseFactory().openDatabase(name)
in one of my projects where I use app_sembast
:
NoSuchMethodError: The method 'call' was called on null.
Receiver: null
Tried calling: call()
#0 BasicLock.synchronized package:synchronized/src/basic_lock.dart:31
#1 SembastDatabase.flush package:sembast/src/database_impl.dart:598
#2 SembastDatabase.open package:sembast/src/database_impl.dart:892
<asynchronous suspension>
#3 DatabaseOpenHelper.openDatabase.<anonymous closure> package:sembast/src/database_factory_mixin.dart:86
<asynchronous suspension>
#4 BasicLock.synchronized package:synchronized/src/basic_lock.dart:33
<asynchronous suspension>
#5 LocalStorage._init package:foro/…/services/local_storage.dart:63
<asynchronous suspension>
I was able to resolve the issue by deleting pubspec.lock
then run flutter packages get
.
It seems that pubspec.lock
didn't have all the transitive dependencies updated accordingly as I compared it to a new project. flutter clean
alone doesn't help in this case but deleting pubspec.lock
does.
Please feel free to close the issue. I just wanted to bring this to your attention in case someone else encounters the same issue in the future.
In a fresh flutter project using latest stable channel (2.5.3) and using the following app_sembast
package:
tekartik_app_flutter_sembast:
git:
url: git://github.com/tekartik/app_flutter_utils.dart
ref: null_safety
path: app_sembast
version: '>=0.1.0'
I'm receiving the following error which is preventing the app from building:
Launching lib/main.dart on iPhone 12 Pro Max in debug mode...
Xcode build done. 16.8s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
Error: Couldn't resolve the package 'process_run' in 'package:process_run/shell_run.dart'.
: Error: Not found: 'package:process_run/shell_run.dart'
import 'package:process_run/shell_run.dart';
^
: Error: Getter not found: 'userAppDataPath'.
var dataPath = join(userAppDataPath, packageName, 'databases');
^^^^^^^^^^^^^^^
Unhandled exception:
FileSystemException(uri=org-dartlang-untranslatable-uri:package%3Aprocess_run%2Fshell_run.dart; message=StandardFileSystem only supports file:* and data:* URIs)
#0 StandardFileSystem.entityForUri (package:front_end/src/api_prototype/standard_file_system.dart:34:7)
#1 asFileUri (package:vm/kernel_front_end.dart:614:37)
#2 writeDepfile (package:vm/kernel_front_end.dart:754:21)
<asynchronous suspension>
#3 FrontendCompiler.compile (package:frontend_server/frontend_server.dart:570:9)
<asynchronous suspension>
#4 starter (package:flutter_frontend_server/server.dart:85:12)
<asynchronous suspension>
#5 main (file:///opt/s/w/ir/cache/builder/src/flutter/flutter_frontend_server/bin/starter.dart:13:24)
<asynchronous suspension>
Failed to package /Users/osaxma/playground/app_sembast_test2.
Command PhaseScriptExecution failed with a nonzero exit code
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Analyzing workspace
note: Constructing build description
note: Build preparation complete
warning: Capabilities for Signing & Capabilities may not function correctly because its entitlements use a placeholder team ID. To resolve this, select a development team in the Runner editor. (in target 'Runner' from project 'Runner')
/Users/osaxma/playground/app_sembast_test2/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.5.99. (in target 'FMDB' from project 'Pods')
Could not build the application for the simulator.
Error launching application on iPhone 12 Pro Max.
Exited (sigterm)
Following the link in the error message, it takes me here:
Unlike the other imports in the same file, the import above isn't clickable from the IDE (cmd + left click).
import 'package:flutter/material.dart';
import 'package:tekartik_app_flutter_sembast/sembast.dart' as sb;
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await sb.getDatabaseFactory().openDatabase('test/local.db');
runApp(const MyApp());
}
[✓] Flutter (Channel stable, 2.5.3, on macOS 11.6 20G165 darwin-x64, locale en)
• Flutter version 2.5.3 at /Users/osaxma/fvm/versions/stable
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 18116933e7 (5 weeks ago), 2021-10-15 10:46:35 -0700
• Engine revision d3ea636dc5
• Dart version 2.14.4
[!] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at /Users/osaxma/Library/Android/sdk
✗ cmdline-tools component is missing
Run `path/to/sdkmanager --install "cmdline-tools;latest"`
See https://developer.android.com/studio/command-line for more details.
✗ Android license status unknown.
Run `flutter doctor --android-licenses` to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.
[✓] Xcode - develop for iOS and macOS
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 12.5.1, Build version 12E507
• CocoaPods version 1.11.2
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 4.1)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
[✓] VS Code (version 1.62.2)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.28.0
[✓] Connected device (3 available)
• iPhone 12 Pro Max (mobile) • 9DA2058E-7269-416B-991F-BA92DE851CE6 • ios • com.apple.CoreSimulator.SimRuntime.iOS-14-5 (simulator)
• macOS (desktop) • macos • darwin-x64 • macOS 11.6 20G165 darwin-x64
• Chrome (web) • chrome • web-javascript • Google Chrome 95.0.4638.69
! Doctor found issues in 1 category.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.