Flutter : The getter 'Pestawait' isn't defined for the class 'RetryOptions' - flutter

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));
}
}
}

Related

when i am trying to running build commad i am getting the below error message

/C:/src/flutter/.pub-cache/hosted/pub.dev/modal_bottom_sheet-2.1.2/lib/src/material_with_modal_page_route.dart:4:1: Error: 'ModalBottomSheetRoute' is imported from both 'package:flutter/src/material/bottom_sheet.dart' and 'package:modal_bottom_sheet/src/bottom_sheet_route.dart'.
import '../modal_bottom_sheet.dart';
^^^^^^^^^^^^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dev/modal_bottom_sheet-2.1.2/lib/src/bottom_sheets/material_bottom_sheet.dart:28:13: Error: 'ModalBottomSheetRoute' is imported from both 'package:flutter/src/material/bottom_sheet.dart' and 'package:modal_bottom_sheet/src/bottom_sheet_route.dart'.
.push(ModalBottomSheetRoute<T>(
^^^^^^^^^^^^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dev/modal_bottom_sheet-2.1.2/lib/src/bottom_sheets/material_bottom_sheet.dart:50:10: Error: A value of type 'Object?' can't be returned from an async function with return type 'Future<T?>'.
- 'Object' is from 'dart:core'.
- 'Future' is from 'dart:async'.
return result;
^
/C:/src/flutter/.pub-cache/hosted/pub.dev/modal_bottom_sheet-2.1.2/lib/src/bottom_sheets/bar_bottom_sheet.dart:102:13: Error: 'ModalBottomSheetRoute' is imported from both 'package:flutter/src/material/bottom_sheet.dart' and 'package:modal_bottom_sheet/src/bottom_sheet_route.dart'.
.push(ModalBottomSheetRoute<T>(
^^^^^^^^^^^^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dev/modal_bottom_sheet-2.1.2/lib/src/bottom_sheets/bar_bottom_sheet.dart:125:10: Error: A value of type 'Object?' can't be returned from an async function with return type 'Future<T?>'.
- 'Object' is from 'dart:core'.
- 'Future' is from 'dart:async'.
return result;
^
Target kernel_snapshot failed: Exception
FAILURE: Build failed with an exception.
* Where:
Script 'C:\src\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1151
* What went wrong:
Execution failed for task ':app:compileFlutterBuildRelease'.
> Process 'command 'C:\src\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 35s
Running Gradle task 'assembleRelease'... 36.7s
Gradle task assembleRelease failed with exit code 1
solution for this error

Flutter app running on web failing with error : app:compileFlutterBuildDebug'

/E:/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore_platform_interface-5.5.0/lib/src/method_channel/method_channel_firestore.dart:112:15: Error: Method not found: 'Error.throwWithStackTrace'.
Error.throwWithStackTrace(
^^^^^^^^^^^^^^^^^^^
/E:/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore_platform_interface-5.5.0/lib/src/method_channel/utils/exception.dart:14:11: Error: Method not found: 'Error.throwWithStackTrace'.
Error.throwWithStackTrace(exception, stackTrace);
^^^^^^^^^^^^^^^^^^^
/E:/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore_platform_interface-5.5.0/lib/src/method_channel/utils/exception.dart:17:9: Error: Method not found: 'Error.throwWithStackTrace'.
Error.throwWithStackTrace(
^^^^^^^^^^^^^^^^^^^
/E:/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore_platform_interface-5.5.0/lib/src/method_channel/utils/exception.dart:12:7: Error: A non-null value must be returned since the return type 'Never' doesn't allow null.
Never convertPlatformException(Object exception, StackTrace stackTrace) {
^
FAILURE: Build failed with an exception.
Where:
Script 'E:\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1035
What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
Process 'command 'E:\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 36s
Exception: Gradle task assembleDebug failed with exit code 1
getData() async {
CollectionReference userRef = FirebaseFirestore.instance.collection("user");
QuerySnapshot querySnapshot = await userRef.get();
List<QueryDocumentSnapshot> listDocs = querySnapshot.docs;
listDocs.forEach((element) {
print(element);
});
}

flutter build error while running the project

I have created on flutter project in window system. it is running with any errors in window. then I have run the same project on ubuntu. I am facing some kind of path not found errors. I have tried all of these things.
run the : 'pub clean' command.
run the : 'flutter doctor' 0 issue found in this command
created a new project and place all the lib folder into the new project in the ubuntu but still
i am facing these errors in console log.
And there is no single error showing in code editor IntelliJ, I also tried it on Android Studio. I am finding the solution for last 2-3 weeks. but no solution found. here is the console part.
console log:
Running Gradle task 'assembleDebug'...
../../Documents/work/flutter/.pub-cache/hosted/pub.dartlang.org/advance_image_picker-0.0.5+3/lib/widgets/portrait_mode_mixin.dart:1:8: Error: Error when reading '../../Documents/work/flutter/packages/flutter/lib/cupertino.Dart': No such file or directory
import 'package:flutter/cupertino.Dart';
^
../../Documents/work/flutter/.pub-cache/hosted/pub.dartlang.org/advance_image_picker-0.0.5+3/lib/widgets/portrait_mode_mixin.dart:2:8: Error: Error when reading '../../Documents/work/flutter/packages/flutter/lib/services.Dart': No such file or directory
import 'package:flutter/services.Dart';
^
../../Documents/work/flutter/.pub-cache/hosted/pub.dartlang.org/advance_image_picker-0.0.5+3/lib/widgets/portrait_mode_mixin.dart:10:28: Error: Type 'StatelessWidget' not found.
mixin PortraitModeMixin on StatelessWidget {
^^^^^^^^^^^^^^^
../../Documents/work/flutter/.pub-cache/hosted/pub.dartlang.org/advance_image_picker-0.0.5+3/lib/widgets/portrait_mode_mixin.dart:12:3: Error: Type 'Widget' not found.
Widget build(BuildContext context) {
^^^^^^
../../Documents/work/flutter/.pub-cache/hosted/pub.dartlang.org/advance_image_picker-0.0.5+3/lib/widgets/portrait_mode_mixin.dart:12:16: Error: Type 'BuildContext' not found.
Widget build(BuildContext context) {
^^^^^^^^^^^^
../../Documents/work/flutter/.pub-cache/hosted/pub.dartlang.org/advance_image_picker-0.0.5+3/lib/widgets/portrait_mode_mixin.dart:24:43: Error: Type 'StatefulWidget' not found.
mixin PortraitStatefulModeMixin<T extends StatefulWidget> on State<T> {
^^^^^^^^^^^^^^
../../Documents/work/flutter/.pub-cache/hosted/pub.dartlang.org/advance_image_picker-0.0.5+3/lib/widgets/portrait_mode_mixin.dart:24:62: Error: Type 'State' not found.
mixin PortraitStatefulModeMixin<T extends StatefulWidget> on State<T> {
^^^^^
../../Documents/work/flutter/.pub-cache/hosted/pub.dartlang.org/advance_image_picker-0.0.5+3/lib/widgets/portrait_mode_mixin.dart:24:62: Error: Expected 0 type arguments.
mixin PortraitStatefulModeMixin<T extends StatefulWidget> on State<T> {
^
../../Documents/work/flutter/.pub-cache/hosted/pub.dartlang.org/advance_image_picker-0.0.5+3/lib/widgets/portrait_mode_mixin.dart:26:3: Error: Type 'Widget' not found.
Widget build(BuildContext context) {
^^^^^^
../../Documents/work/flutter/.pub-cache/hosted/pub.dartlang.org/advance_image_picker-0.0.5+3/lib/widgets/portrait_mode_mixin.dart:26:16: Error: Type 'BuildContext' not found.
Widget build(BuildContext context) {
^^^^^^^^^^^^
../../Documents/work/flutter/.pub-cache/hosted/pub.dartlang.org/advance_image_picker-0.0.5+3/lib/widgets/portrait_mode_mixin.dart:12:16: Error: 'BuildContext' isn't a type.
Widget build(BuildContext context) {
^^^^^^^^^^^^
../../Documents/work/flutter/.pub-cache/hosted/pub.dartlang.org/advance_image_picker-0.0.5+3/lib/widgets/portrait_mode_mixin.dart:14:18: Error: Method not found: 'SizedBox'.
return const SizedBox();
^^^^^^^^
../../Documents/work/flutter/.pub-cache/hosted/pub.dartlang.org/advance_image_picker-0.0.5+3/lib/widgets/portrait_mode_mixin.dart:26:16: Error: 'BuildContext' isn't a type.
Widget build(BuildContext context) {
^^^^^^^^^^^^
../../Documents/work/flutter/.pub-cache/hosted/pub.dartlang.org/advance_image_picker-0.0.5+3/lib/widgets/portrait_mode_mixin.dart:28:18: Error: Method not found: 'SizedBox'.
return const SizedBox();
^^^^^^^^
../../Documents/work/flutter/.pub-cache/hosted/pub.dartlang.org/advance_image_picker-0.0.5+3/lib/widgets/portrait_mode_mixin.dart:33:11: Error: Superclass has no method named 'dispose'.
super.dispose();
^^^^^^^
../../Documents/work/flutter/.pub-cache/hosted/pub.dartlang.org/advance_image_picker-0.0.5+3/lib/widgets/portrait_mode_mixin.dart:41:5: Error: Getter not found: 'DeviceOrientation'.
DeviceOrientation.portraitUp,
^^^^^^^^^^^^^^^^^
../../Documents/work/flutter/.pub-cache/hosted/pub.dartlang.org/advance_image_picker-0.0.5+3/lib/widgets/portrait_mode_mixin.dart:42:5: Error: Getter not found: 'DeviceOrientation'.
DeviceOrientation.portraitDown,
^^^^^^^^^^^^^^^^^
../../Documents/work/flutter/.pub-cache/hosted/pub.dartlang.org/advance_image_picker-0.0.5+3/lib/widgets/portrait_mode_mixin.dart:40:3: Error: Getter not found: 'SystemChrome'.
SystemChrome.setPreferredOrientations([
^^^^^^^^^^^^
../../Documents/work/flutter/.pub-cache/hosted/pub.dartlang.org/advance_image_picker-0.0.5+3/lib/widgets/portrait_mode_mixin.dart:48:5: Error: Getter not found: 'DeviceOrientation'.
DeviceOrientation.portraitUp,
^^^^^^^^^^^^^^^^^
../../Documents/work/flutter/.pub-cache/hosted/pub.dartlang.org/advance_image_picker-0.0.5+3/lib/widgets/portrait_mode_mixin.dart:49:5: Error: Getter not found: 'DeviceOrientation'.
DeviceOrientation.portraitDown,
^^^^^^^^^^^^^^^^^
../../Documents/work/flutter/.pub-cache/hosted/pub.dartlang.org/advance_image_picker-0.0.5+3/lib/widgets/portrait_mode_mixin.dart:50:5: Error: Getter not found: 'DeviceOrientation'.
DeviceOrientation.landscapeLeft,
^^^^^^^^^^^^^^^^^
../../Documents/work/flutter/.pub-cache/hosted/pub.dartlang.org/advance_image_picker-0.0.5+3/lib/widgets/portrait_mode_mixin.dart:51:5: Error: Getter not found: 'DeviceOrientation'.
DeviceOrientation.landscapeRight,
^^^^^^^^^^^^^^^^^
../../Documents/work/flutter/.pub-cache/hosted/pub.dartlang.org/advance_image_picker-0.0.5+3/lib/widgets/portrait_mode_mixin.dart:47:3: Error: Getter not found: 'SystemChrome'.
SystemChrome.setPreferredOrientations([
^^^^^^^^^^^^
FAILURE: Build failed with an exception.
* Where:
Script '/home/pankaj/Documents/work/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 1035
* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command '/home/pankaj/Documents/work/flutter/bin/flutter'' 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 1m 46s
Exception: Gradle task assembleDebug failed with exit code 1
Issue in that is it takes your windows path which you created
I think it may resolve your issue..
Open the project folder path in your terminal and run this command:
flutter clean
Once finish,
Run this command
flutter pub get
If it will not resolve your issue create new project in ubuntu and copy lib folder in your project and replace that lib folder in new project.

Flutter Freezed : Error: Getter not found:

I used Freezed package and need generating json . But when get response from API faced error type 'String' is not a subtype of type 'int' in type cast. This error known because my response from API String but i make integer in model
After searching to fixed solution , i found to solved this from this issue .But when build the application i get this error :
Launching lib\main.dart on Redmi Note 4 in debug mode...
Compiler message:
lib/src/network/models/utang/utang_model.freezed.dart:223:20: Error: Getter not found: '_stringToInt'.
#JsonKey(fromJson: _stringToInt, toJson: _stringFromInt)
^^^^^^^^^^^^
lib/src/network/models/utang/utang_model.freezed.dart:223:42: Error: Getter not found: '_stringFromInt'.
#JsonKey(fromJson: _stringToInt, toJson: _stringFromInt)
^^^^^^^^^^^^^^
Compiler message:
lib/src/network/models/utang/utang_model.freezed.dart:223:20: Error: Getter not found: '_stringToInt'.
#JsonKey(fromJson: _stringToInt, toJson: _stringFromInt)
^^^^^^^^^^^^
lib/src/network/models/utang/utang_model.freezed.dart:223:42: Error: Getter not found: '_stringFromInt'.
#JsonKey(fromJson: _stringToInt, toJson: _stringFromInt)
^^^^^^^^^^^^^^
Target kernel_snapshot failed: Exception: Errors during snapshot creation: null
build failed.
FAILURE: Build failed with an exception.
* Where:
Script 'C:\flutter\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 882
* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'C:\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 23s
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)
Model
#freezed
abstract class UtangModel with _$UtangModel {
#JsonSerializable(fieldRename: FieldRename.snake)
#JsonKey(fromJson: _stringToInt, toJson: _stringFromInt)
const factory UtangModel({
String idUtang,
UserGoogleModel pembertang,
UserGoogleModel pengutang,
int totalUtang,
int sisaUtang,
DateTime tglKembali,
String status,
String keterangan,
String selfie,
String ttd,
DateTime createdDate,
}) = _UtangModel;
factory UtangModel.fromJson(Map<String, dynamic> json) => _$UtangModelFromJson(json);
static int _stringToInt(String number) => number == null ? null : int.parse(number);
static String _stringFromInt(int number) => number?.toString();
}
I missed something ?
You have to indicate that this function is from the abstract class UtangModel:
#freezed
abstract class UtangModel with _$UtangModel {
#JsonSerializable(fieldRename: FieldRename.snake)
const factory UtangModel({
String idUtang,
UserGoogleModel pembertang,
UserGoogleModel pengutang,
#JsonKey(fromJson: UtangModel._stringToInt, toJson: UtangModel._stringFromInt)int totalUtang,
int sisaUtang,
DateTime tglKembali,
String status,
String keterangan,
String selfie,
String ttd,
DateTime createdDate,
}) = _UtangModel;
factory UtangModel.fromJson(Map<String, dynamic> json) => _$UtangModelFromJson(json);
static int _stringToInt(String number) => number == null ? null : int.parse(number);
static String _stringFromInt(int number) => number?.toString();
}

'StethoHttpClientResponse' is missing implementations for these members: - HttpClientResponse.compressionState in flutter_stetho

I am tried to use flutter_stetho package when it Compile the compiler shown ..
Launching lib/main.dart on Android SDK built for x86 in debug mode...
Compiler message:
file:///home/administrator/softwares/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_stetho-0.2.2/lib/src/http_client_response.dart:4:7: Error: The non-abstract class 'StethoHttpClientResponse' is missing implementations for these members:
- HttpClientResponse.compressionState
Try to either
- provide an implementation,
- inherit an implementation from a superclass or mixin,
- mark the class as abstract, or
- provide a 'noSuchMethod' implementation.
class StethoHttpClientResponse extends StreamView<List<int>>
^^^^^^^^^^^^^^^^^^^^^^^^
org-dartlang-sdk:///third_party/dart/sdk/lib/_http/http.dart:1967:42: Context: 'HttpClientResponse.compressionState' is defined here.
HttpClientResponseCompressionState get compressionState;
^^^^^^^^^^^^^^^^
Compiler failed on /home/administrator/projects/mobile/sampleapp/lib/main.dart
FAILURE: Build failed with an exception.
* Where:
Script '/home/administrator/softwares/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 665
* What went wrong:
Execution failed for task ':app:compileflutterBuildDebugX86'.
> Process 'command '/home/administrator/softwares/flutter/bin/flutter'' 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 20s
Gradle task assembleDebug failed with exit code 1
Exited (sigterm)
I have just faced the same error, I'm leaving the stack trace below for reference.
For me it was caused because I left a reference to a parameter in a copy-pasted method.
I had this:
Map<String, dynamic> toJson() {
return User(
login: json['login'],
password: json['password'],
firstName: json['firstName'],
lastName: json['lastName'],
email: json['email'],
cellphone: json['cellphone'],
);
}
But the correct code is actually:
Map<String, dynamic> toJson() {
return {
'login': login,
'password': password,
'firstName': firstName,
'lastName': lastName,
'email': email,
'cellphone': cellphone,
};
}
What was odd or sneaky in my case was that Visual Studio Code was not pointing out the error after opening the file.
Also, I left the constructor method from the class I based on (copy pasted) which was User
Stack trace:
Compiler message:
lib/models/rest/user_post.dart:3:7: Error: The non-abstract class 'UserPost' is missing implementations for these members:
- UserPost.User
Try to either
- provide an implementation,
- inherit an implementation from a superclass or mixin,
- mark the class as abstract, or
- provide a 'noSuchMethod' implementation.
class UserPost {
^^^^^^^^
lib/models/rest/user_post.dart:33:3: Context: 'UserPost.User' is defined here.
User({
^^^^
lib/models/rest/user_post.dart:15:14: Error: Getter not found: 'json'.
login: json['login'],
^^^^
lib/models/rest/user_post.dart:16:17: Error: Getter not found: 'json'.
password: json['password'],
^^^^
lib/models/rest/user_post.dart:17:18: Error: Getter not found: 'json'.
firstName: json['firstName'],
^^^^
lib/models/rest/user_post.dart:18:17: Error: Getter not found: 'json'.
lastName: json['lastName'],
^^^^
lib/models/rest/user_post.dart:19:14: Error: Getter not found: 'json'.
email: json['email'],
^^^^
lib/models/rest/user_post.dart:20:18: Error: Getter not found: 'json'.
cellphone: json['cellphone'],
^^^^