I'm creating an integration test to my flutter app but I get this error when finding an TextInput and trying to type inside.
The error: 'package:flutter_test/src/binding.dart': Failed assertion: line 1649 pos 12: '_pendingFrame == null': is not true.
The code:
final Finder email = find.byWidgetPredicate(
(widget) => widget is FutXTextField && widget.title == 'EMAIL',
);
expect(email, findsOneWidget,
reason: " Só pode haver um botão de escrever email");
await tester.enterText(email, "teste#teste.teste");
I didn`t find it anywhere on the internet what this error is.
Does anyone had this exception before and has any idea of how to solve it?
I had the same error when the app that I was running the test on threw an exception, if you check the logs do you see any errors occurring before your test failed?
Related
I am using gesture tap to close the article detail page, when I reopen the article detail page, the app will show this error(the first time open the detail works fine, the second time open the detail will show this error and the detail could not roll up and down):
======== Exception caught by gesture library =======================================================
The following assertion was thrown while dispatching a pointer event:
'package:flutter/src/gestures/tap.dart': Failed assertion: line 201 pos 14: '_down == null && _up == null': is not true.
Either the assertion indicates an error in the framework itself, or we should provide substantially more information in this error message to help you determine and fix the underlying cause.
In either case, please report this assertion by filing a bug on GitHub:
https://github.com/flutter/flutter/issues/new?template=2_bug.md
When the exception was thrown, this was the stack:
#2 BaseTapGestureRecognizer.addAllowedPointer (package:flutter/src/gestures/tap.dart:201:14)
#3 GestureRecognizer.addPointer (package:flutter/src/gestures/recognizer.dart:102:7)
#4 RawGestureDetectorState._handlePointerDown (package:flutter/src/widgets/gesture_detector.dart:1204:18)
#5 RenderPointerListener.handleEvent (package:flutter/src/rendering/proxy_box.dart:2821:29)
#6 GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:361:22)
...
Event: PointerDownEvent#6e7c4(position: Offset(191.4, 563.1))
position: Offset(191.4, 563.1)
Target: RenderPointerListener#946e9 relayoutBoundary=up46
parentData: <none> (can use size)
constraints: BoxConstraints(0.0<=w<=363.4, 0.0<=h<=Infinity)
size: Size(363.4, 458.2)
behavior: deferToChild
listeners: down
====================================================================================================
and this is my detail page flutter code:
return GestureDetector(
onHorizontalDragStart: _onHorizontalDragStart,
onHorizontalDragUpdate: _onHorizontalDragUpdate,
onHorizontalDragEnd: _onHorizontalDragEnd,
child: Container(
constraints: BoxConstraints(
minHeight: MediaQuery.of(context).size.height * 0.9,
),
color: Theme.of(context).scaffoldBackgroundColor,
child: Padding(
padding: const EdgeInsets.all(16.0),
child: buildListView(item, context),
),
));
void _onHorizontalDragStart(DragStartDetails details) {
_initialSwipeOffset = details.globalPosition;
}
void _onHorizontalDragUpdate(DragUpdateDetails details) {
_finalSwipeOffset = details.globalPosition;
}
void _onHorizontalDragEnd(DragEndDetails details) {
if (_initialSwipeOffset != null) {
final offsetDifference = _initialSwipeOffset!.dx - _finalSwipeOffset!.dx;
if (offsetDifference < 0) {
Navigator.pop(context);
}
}
}
I am searching from internet but find no one encount this problem. what should I do to fix this problem?
It looks like you are using a pre-release version of Flutter SDK. I recommend you use Flutter Stable channel and rebuild your project again.
according to Flutter build release channels
the stable version is recommended for all production app releases.
Now to know which branch you are currently using. open the terminal and type the following command.
flutter channel
The channel which you are on will be displayed with '*' at the beginning. E.g,
*master
dev
beta
stable
To change to the stable channel, run this command on your terminal.
flutter channel CHANNEL_NAME
For example, change the channel to stable,
flutter channel stable
To ensure that you're on the latest build from this channel, run
flutter upgrade
This is all you need to do.
When I add flutter consumer component in flutter like this:
SliverPadding(
padding: const EdgeInsets.symmetric(vertical: 8.0),
sliver: Consumer(
(context, read) {
return read(storiesTypeProvider(articleRequest)).when(
loading: () {
// return SliverFillRemaining(
// child: Center(child: CircularProgressIndicator()));
return SliverToBoxAdapter(child: Center(child: LoadingItem()));
},
error: (err, stack) {
print(err);
return SliverToBoxAdapter(
child: Center(child: Text('Error: $err')));
},
data: (ids) {
//return StoryList(ids: ids,storiesType: articleRequest.storiesType,);
},
);
},
),
)
shows this error:
flutter: [debug] Capture from onError 'package:flutter/src/widgets/nested_scroll_view.dart': Failed assertion: line 806 pos 14: 'position.hasContentDimensions && position.hasPixels': is not true.
flutter: [debug] Capture from onError 'package:flutter/src/widgets/nested_scroll_view.dart': Failed assertion: line 806 pos 14: 'position.hasContentDimensions && position.hasPixels': is not true.
======== Exception caught by widgets library =======================================================
The following StateError was thrown building RawGestureDetector-[LabeledGlobalKey<RawGestureDetectorState>#0ac5b](state: RawGestureDetectorState#734b4(gestures: <none>, behavior: opaque)):
Bad state: No ProviderScope found
The relevant error-causing widget was:
SmartRefresher file:///Users/dolphin/Documents/GitHub/cruise-open/lib/src/page/home/components/homelistdefault_component/view.dart:47:22
When the exception was thrown, this was the stack:
#0 ProviderStateOwnerScope.of (package:flutter_riverpod/src/framework.dart:216:7)
#1 _ConsumerState.didChangeDependencies (package:flutter_riverpod/src/consumer.dart:107:46)
#2 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4839:11)
#3 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4655:5)
... Normal element mounting (4 frames)
...
====================================================================================================
======== Exception caught by scheduler library =====================================================
'package:flutter/src/widgets/nested_scroll_view.dart': Failed assertion: line 806 pos 14: 'position.hasContentDimensions && position.hasPixels': is not true.
====================================================================================================
======== Exception caught by scheduler library =====================================================
'package:flutter/src/widgets/nested_scroll_view.dart': Failed assertion: line 806 pos 14: 'position.hasContentDimensions && position.hasPixels': is not true.
====================================================================================================
now I am using fish-redux to manage my flutter state, should I must using ProviderScope? what should I do to fix this problem? this is the storiesTypeProvider:
final storiesTypeProvider = FutureProvider.family((ref, type) async {
return await Repo.getArticles(type);
});
If you use flutter_riverpod.
You need to add ProviderScope to the main() function.
Like this:
void main() {
runApp(ProviderScope(child: MyApp()));
}
I try to implement an app. And I run it several times with no errors. But without any reason, and after a day I try to run my app, I got the below error, and I try to find a solution for id but I did not find anything.
So can someone provide me how can I solve it?
Launching lib\main.dart on sdk gphone x86 in debug mode...
lib\main.dart
../../../flutter/flutter/.pub-cache/hosted/pub.dartlang.org/retry-3.0.1/lib/retry.dart:131:16: Error: Expected ';' after this.
return Pestawait fn();
^^^^^^^^^
../../../flutter/flutter/.pub-cache/hosted/pub.dartlang.org/retry-3.0.1/lib/retry.dart:131:16: Error: The getter 'Pestawait' isn't defined for the class 'RetryOptions'.
- 'RetryOptions' is from 'package:retry/retry.dart' ('../../../flutter/flutter/.pub-cache/hosted/pub.dartlang.org/retry-3.0.1/lib/retry.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'Pestawait'.
return Pestawait fn();
^^^^^^^^^
../../../flutter/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_datetime_picker-1.4.0/lib/flutter_datetime_picker.dart:215:48: Error: No named parameter with the name 'shadowThemeOnly'.
ThemeData inheritTheme = Theme.of(context, shadowThemeOnly: true);
^^^^^^^^^^^^^^^
../../../flutter/flutter/packages/flutter/lib/src/material/theme.dart:119:20: Context: Found this candidate, but the arguments don't match.
static ThemeData of(BuildContext context) {
^^
FAILURE: Build failed with an exception.
* Where:
Script 'D:\mohy\flutter\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 900
* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'D:\mohy\flutter\flutter\bin\flutter.bat'' finished with non-zero exit value 1
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 9m 1s
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)
It seems your library is broken. You can delete that folder and install that package again. Or for a quick fix, you can change that part in the related file as in here.
Future<T> retry<T>(
FutureOr<T> Function() fn, {
FutureOr<bool> Function(Exception)? retryIf,
FutureOr<void> Function(Exception)? onRetry,
}) async {
var attempt = 0;
// ignore: literal_only_boolean_expressions
while (true) {
attempt++; // first invocation is the first attempt
try {
return await fn(); // Here is broken!
} on Exception catch (e) {
if (attempt >= maxAttempts ||
(retryIf != null && !(await retryIf(e)))) {
rethrow;
}
if (onRetry != null) {
await onRetry(e);
}
}
// Sleep for a delay
await Future.delayed(delay(attempt));
}
}
}
I got this error. How can i solve it???
Appreciate any help
I/flutter ( 8131): The following assertion was thrown building Answer(dirty):
I/flutter ( 8131): A non-null String must be provided to a Text widget.
I/flutter ( 8131): 'package:flutter/src/widgets/text.dart':
I/flutter ( 8131): Failed assertion: line 285 pos 10: 'data != null'
I/flutter ( 8131): Either the assertion indicates an error in the framework itself, or we should provide substantially
I/flutter ( 8131): more information in this error message to help you determine and fix the underlying cause.
I/flutter ( 8131): In either case, please report this assertion by filing a bug on GitHub:
When using Text widget, you need to provide some value.
Code like this will fail:
Text()
And code like this will pass:
Text('Some text')
Take a look inside your app where you forgot to put the value for Text widget.
If you are using variables, it might happen that value is null, and you didn't check for that.
Text(someValue == null ? '' : someValue)
Error receiving connection: java.net.SocketException: Invalid argument
Exception in thread "Thread-698" java.lang.RuntimeException: Did not
establish input/output at
Handin2.ConnectionHandlerImpl.run(ConnectionHandlerImpl.java:124) at
java.lang.Thread.run(Thread.java:722)
I have been searching a lot on this exception. Everywhere it seems to be the conclusion that if you compile with the JVM option -Djava.net.preferIPv4Stack=true it will solve the problem. It doesn't for me though. I am running IntelliJ and trying to implement a Chord system with Sockets and Threads. This is where the above mentioned exception is caught and thrown:
if(this.remote == null || this.node == null) {
throw new RuntimeException("Connection handler has not been properly "
+ "initalialized");
}
try{
if(this.out == null) {
this.out = new ObjectOutputStream(remote.getOutputStream());
}
if(this.in == null) {
this.in = new ObjectInputStream(remote.getInputStream());
}
} catch(IOException e) {
System.out.println("Trying to make input/output for remote " + remote);
System.err.println(node.getKey()/Constants.NORMALIZE_KEY+": Error receiving connection: " + e.toString());
return false;
}
I don't know if more code snippets are needed in order to help, but I am simply lost on this exception since the solutions when searching are not helping at all.
Any hints on what triggers this error? The socket exception is caught by the given try-catch block as a special case of an IO exception
if you compile with the JVM option -Djava.net.preferIPv4Stack=true it will solve the problem.
No. If you execute with that JVM option. Nothing to do with the compiler.