Home > Mobile >  When I using hive in flutter , ios simulator can not run,
When I using hive in flutter , ios simulator can not run,

Time:06-09

Launching lib/main.dart on iPhone 13 Pro Max in debug mode... lib/main.dart:1 Xcode build done. 18,3s Failed to build iOS app Error output from Xcode build: ↳ ** BUILD FAILED ** Xcode's output: ↳ Writing result bundle at path: /var/folders/lw/s0wrzngj5vz7fzqd1349cb1c0000gn/T/flutter_tools.vdi8q9/flutter_ios_build_temp_dirVK4qWh/temporary_xcresult_bundle : Error: The getter 'box' isn't defined for the class 'WatchBoxBuilder Function()'. ../…/src/watch_box_builder.dart:54

  • 'WatchBoxBuilder' is from 'package:hive_flutter/hive_flutter.dart' ('../../../development/flutter/.pub-cache/hosted/pub.dartlang.org/hive_flutter-1.1.0/lib/hive_flutter.dart'). package:hive_flutter/hive_flutter.dart:1 Try correcting the name to the name of an existing getter, or defining a getter or field named 'box'. if (widget.box != oldWidget.box) { ^^^ : Error: The getter 'box' isn't defined for the class 'WatchBoxBuilder Function()'. ../…/src/watch_box_builder.dart:61
  • 'WatchBoxBuilder' is from 'package:hive_flutter/hive_flutter.dart' ('../../../development/flutter/.pub-cache/hosted/pub.dartlang.org/hive_flutter-1.1.0/lib/hive_flutter.dart'). package:hive_flutter/hive_flutter.dart:1 Try correcting the name to the name of an existing getter, or defining a getter or field named 'box'. subscription = widget.box.watch().listen((event) { ^^^ : Error: The getter 'watchKeys' isn't defined for the class 'WatchBoxBuilder Function()'. ../…/src/watch_box_builder.dart:62
  • 'WatchBoxBuilder' is from 'package:hive_flutter/hive_flutter.dart' ('../../../development/flutter/.pub-cache/hosted/pub.dartlang.org/hive_flutter-1.1.0/lib/hive_flutter.dart'). package:hive_flutter/hive_flutter.dart:1 Try correcting the name to the name of an existing getter, or defining a getter or field named 'watchKeys'. if (widget.watchKeys != null && !widget.watchKeys!.contains(event.key)) { ^^^^^^^^^ : Error: The getter 'watchKeys' isn't defined for the class 'WatchBoxBuilder Function()'. ../…/src/watch_box_builder.dart:62
  • 'WatchBoxBuilder' is from 'package:hive_flutter/hive_flutter.dart' ('../../../development/flutter/.pub-cache/hosted/pub.dartlang.org/hive_flutter-1.1.0/lib/hive_flutter.dart'). package:hive_flutter/hive_flutter.dart:1 Try correcting the name to the name of an existing getter, or defining a getter or field named 'watchKeys'. if (widget.watchKeys != null && !widget.watchKeys!.contains(event.key)) { ^^^^^^^^^ : Error: The method 'builder' isn't defined for the class 'WatchBoxBuilder Function()'. ../…/src/watch_box_builder.dart:76
  • 'WatchBoxBuilder' is from 'package:hive_flutter/hive_flutter.dart' ('../../../development/flutter/.pub-cache/hosted/pub.dartlang.org/hive_flutter-1.1.0/lib/hive_flutter.dart'). package:hive_flutter/hive_flutter.dart:1 Try correcting the name to the name of an existing method, or defining a method named 'builder'. return widget.builder(context, widget.box); ^^^^^^^ : Error: The getter 'box' isn't defined for the class 'WatchBoxBuilder Function()'. ../…/src/watch_box_builder.dart:76
  • 'WatchBoxBuilder' is from 'package:hive_flutter/hive_flutter.dart' ('../../../development/flutter/.pub-cache/hosted/pub.dartlang.org/hive_flutter-1.1.0/lib/hive_flutter.dart'). package:hive_flutter/hive_flutter.dart:1 Try correcting the name to the name of an existing getter, or defining a getter or field named 'box'. return widget.builder(context, widget.box); ^^^ : Error: Expected an identifier, but got ')'. lib/myHive.dart:21 Try inserting an identifier before ')'. ); ^ : Error: Expected ';' after this. lib/myHive.dart:20 ); ^ : Error: Unexpected token ';'. lib/myHive.dart:21 ); ^ Failed to package /Users/ekrembulut/Desktop/FlutterProjects/hiveee. Command PhaseScriptExecution failed with a nonzero exit code note: Using new build system note: Planning note: Build preparation complete note: Building targets in dependency order Result bundle written to path: /var/folders/lw/s0wrzngj5vz7fzqd1349cb1c0000gn/T/flutter_tools.vdi8q9/flutter_ios_build_temp_dirVK4qWh/temporary_xcresult_bundle Could not build the application for the simulator. Error launching application on iPhone 13 Pro Max.

CodePudding user response:

I solved problem . I will explain how to solve . Hive library is using its methods as a static but it should use with constructor. When error was triggering , we should use “()” for solution . In package , change widget.something to widget().something.

  • Related