1

my previous project I used flushbar plugin without any error. but my new project when try to use flushbar i got error..

Project is working well without flushbar.

full error message

Compiler message:
file:///Users/bhanukaisuru/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/flushbar-1.7.0/lib/flushbar.dart:207:3: Error: Type 'FocusAttachment' not found.
  FocusAttachment _focusAttachment;
  ^^^^^^^^^^^^^^^
file:///Users/bhanukaisuru/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/flushbar-1.7.0/lib/flushbar.dart:207:3: Error: 'FocusAttachment' isn't a type.
  FocusAttachment _focusAttachment;
  ^^^^^^^^^^^^^^^
file:///Users/bhanukaisuru/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/flushbar-1.7.0/lib/flushbar.dart:228:35: Error: The method 'attach' isn't defined for the class 'FocusScopeNode'.
 - 'FocusScopeNode' is from 'package:flutter/src/widgets/focus_manager.dart' ('file:///Users/bhanukaisuru/Documents/flutter/packages/flutter/lib/src/widgets/focus_manager.dart').
Try correcting the name to the name of an existing method, or defining a method named 'attach'.
    _focusAttachment = _focusNode.attach(context);
                                  ^^^^^^
file:///Users/bhanukaisuru/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/flushbar-1.7.0/lib/flushbar.dart:239:16: Error: The method 'dispose' isn't defined for the class 'FocusScopeNode'.
 - 'FocusScopeNode' is from 'package:flutter/src/widgets/focus_manager.dart' ('file:///Users/bhanukaisuru/Documents/flutter/packages/flutter/lib/src/widgets/focus_manager.dart').
Try correcting the name to the name of an existing method, or defining a method named 'dispose'.
    _focusNode.dispose();

I tried these four version, but nothing change

  flushbar: ^1.3.0
  flushbar: ^1.5.3
  flushbar: ^1.7.0
  flushbar: ^1.6.0

and also I used,

  FocusScope.of(context).requestFocus(FocusNode()),
user9139407
  • 964
  • 1
  • 12
  • 25

1 Answers1

1

I was facing the same problem after flutter upgrade. Remove ^ from your pubspec.yaml for now. It should work.

 flushbar: 1.5.3

Reference : https://github.com/flutter/flutter/issues/33827

Rahul Bagal
  • 220
  • 3
  • 7
  • I will try and let you know... What is meaning of this `^` – user9139407 Jul 04 '19 at 14:20
  • 1
    The caret sign (^) is used for pub dependencies in Dart to indicate a range of version numbers are allowed. Specifically, any version from the specified version up to (but not including) the next non-breaking version is ok. `So ^3.1.5 is the same as '>=3.1.5 <4.0.0'` `And ^1.2.3 would be the same as '>=1.2.3 <2.0.0'` Reference : https://stackoverflow.com/questions/53563079/what-is-the-caret-sign-before-the-dependency-version-number-in-flutters-pub – Rahul Bagal Jul 05 '19 at 10:36