syedmurtaza108 / chucker-flutter Goto Github PK
View Code? Open in Web Editor NEWAn HTTP requests inspector inspired by Chucker Android
Home Page: https://pub.dev/packages/chucker_flutter
License: MIT License
An HTTP requests inspector inspired by Chucker Android
Home Page: https://pub.dev/packages/chucker_flutter
License: MIT License
Describe the bug
Chucker pop up shows multiple times on one endpoint hit after upgrading to version 1.6.3
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Show only one pop up on one endpoint hit
Version (please complete the following information):
Describe the bug
Error when upload a file (dio.post with FormData), If remove ChuckerDioInterceptor from Dio, then dio works fine.
Log
E/flutter: [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: Converting object to an encodable object failed: Instance of 'ApiResponse'
#0 _JsonStringifier.writeObject (dart:convert/json.dart:794:7)
#1 _JsonStringifier.writeList (dart:convert/json.dart:845:9)
#2 _JsonStringifier.writeJsonValue (dart:convert/json.dart:824:7)
#3 _JsonStringifier.writeObject (dart:convert/json.dart:785:9)
#4 _JsonStringStringifier.printOn (dart:convert/json.dart:983:17)
#5 _JsonStringStringifier.stringify (dart:convert/json.dart:968:5)
#6 JsonEncoder.convert (dart:convert/json.dart:345:30)
#7 JsonCodec.encode (dart:convert/json.dart:231:45)
#8 jsonEncode (dart:convert/json.dart:114:10)
#9 SharedPreferencesManager.addApiResponse (package:chucker_flutter/src/helpers/shared_preferences_manager.dart:44:7)
<asynchronous suspension>
#10 ChuckerDioInterceptor._saveResponse (package:chucker_flutter/src/interceptors/dio_interceptor.dart:55:5)
<asynchronous suspension>
#11 ChuckerDioInterceptor.onResponse (package:chucker_flutter/src/interceptors/dio_interceptor.dart:35:5)
<asynchronous suspension>
Version (please complete the following information):
Update all the packages used in chucker to latest, like intl.
Describe the bug
When using chucker_flutter wrapper as http client, somehow it capture the correct character on chucker log but not as http response.
To Reproduce
Steps to reproduce the behavior:
import 'package:chucker_flutter/chucker_flutter.dart';
import 'package:dio/dio.dart';
import 'package:example/chopper/chopper_service.dart';
import 'package:flutter/material.dart';
import 'package:http/http.dart' as http;
void main() {
ChuckerFlutter.showOnRelease = true;
runApp(const App());
}
class App extends StatelessWidget {
const App({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
navigatorObservers: [ChuckerFlutter.navigatorObserver],
theme: ThemeData(
appBarTheme: const AppBarTheme(color: Color(0xFF13B9FF)),
colorScheme: ColorScheme.fromSwatch(
accentColor: const Color(0xFF13B9FF),
),
),
home: const TodoPage(),
);
}
}
class TodoPage extends StatefulWidget {
const TodoPage({Key? key}) : super(key: key);
@override
State<TodoPage> createState() => _TodoPageState();
}
class _TodoPageState extends State<TodoPage> {
final _baseUrl = 'https://jsonplaceholder.typicode.com';
final _specialCharacterUrl = "https://gist.githubusercontent.com/fahami/b01f9c23cfa5f1d8f1ac18a1293fa069/raw/alphabet.json";
var _clientType = _Client.http;
String result = "";
late final _dio = Dio(
BaseOptions(
sendTimeout: 30000,
connectTimeout: 30000,
receiveTimeout: 30000,
),
);
final _originalClient = http.Client();
final _chuckerHttpClient = ChuckerHttpClient(http.Client());
final _chopperApiService = ChopperApiService.create();
Future<void> get({bool error = false, bool specialCharacter = false, bool useOriginalClient = false}) async {
try {
//To produce an error response just adding random string to path
final path = '/post${error ? 'temp' : ''}s/1';
switch (_clientType) {
case _Client.dio:
_dio.get('$_baseUrl$path');
break;
case _Client.http:
final url = specialCharacter ? Uri.parse(_specialCharacterUrl) : Uri.parse('$_baseUrl$path');
final res = useOriginalClient ? await _originalClient.get(url) : await _chuckerHttpClient.get(url);
setState(() {
result = res.body;
});
break;
case _Client.chopper:
error ? _chopperApiService.getError() : _chopperApiService.get();
break;
}
} catch (e) {
debugPrint(e.toString());
}
}
@override
void initState() {
super.initState();
_dio.interceptors.add(ChuckerDioInterceptor());
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Chucker Flutter Example'),
),
persistentFooterButtons: [
Text('Using ${_clientType.name} library'),
const SizedBox(width: 16),
ElevatedButton(
onPressed: () {
setState(
() {
switch (_clientType) {
case _Client.dio:
_clientType = _Client.http;
break;
case _Client.http:
_clientType = _Client.chopper;
break;
case _Client.chopper:
_clientType = _Client.dio;
break;
}
},
);
},
child: Text(
'Change to ${_clientType == _Client.dio ? 'Http' : _clientType == _Client.http ? 'Chopper' : 'Dio'}',
),
)
],
body: SingleChildScrollView(
padding: const EdgeInsets.all(16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
const SizedBox(height: 16),
ChuckerFlutter.chuckerButton,
const SizedBox(height: 16),
ElevatedButton(
onPressed: get,
child: const Text('GET'),
),
ElevatedButton(
onPressed: () => get(specialCharacter: true),
child: const Text('GET special character using Chucker Interceptor'),
),
ElevatedButton(
onPressed: () => get(specialCharacter: true, useOriginalClient: true),
child: const Text('GET special character using original HTTP Client'),
),
Text(result),
],
),
),
);
}
}
enum _Client {
dio,
http,
chopper,
}
Expected behavior
Return HTTP response as original HTTP Client did
Version (please complete the following information):
Describe the bug
Chucker toast is renderflex overflowed so I couldn't click the details button
To Reproduce
Steps to reproduce the behavior:
Version (please complete the following information):
[✓] Flutter (Channel stable, 2.10.2, on macOS 12.3.1 21E258 darwin-arm, locale en-ID)
• Flutter version 2.10.2 at /Users/Tara/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 097d3313d8 (4 months ago), 2022-02-18 19:33:08 -0600
• Engine revision a83ed0e5e3
• Dart version 2.16.1
• DevTools version 2.9.2
[✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
• Android SDK at /Users/Tara/Library/Android/sdk
• Platform android-32, build-tools 32.1.0-rc1
• Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7772763)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 13.4.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• CocoaPods version 1.11.2
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2021.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 11.0.11+0-b60-7772763)
[✓] VS Code (version 1.67.2)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension can be installed from:
🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
Right now, there's no way to set initial values for any of the settings that the plugin allos (e.g. Notifications enabled/disabled, alignment, duration, http method, api requests thereshold...)
Describe the bug
This package depends on did 4.0.4 and throws error with dio 5.0.
Because every version of chucker_flutter depends on dio ^4.0.4 and app depends on dio ^5.0.0, chucker_flutter is forbidden.
This should be fairly simple to fix if there are not any breaking changes in updating dio.
Hello dev, is this package already support for flutter_graphql ?
Thank you
Describe the bug
report error when reponse body is empty
E/flutter (30457): [ERROR:flutter/lib/ui/ui_dart_state.cc(198)] Unhandled Exception: Converting object to an encodable object failed: Instance of 'ApiResponse'
E/flutter (30457): #0 _JsonStringifier.writeObject (dart:convert/json.dart:794:7)
E/flutter (30457): #1 _JsonStringifier.writeList (dart:convert/json.dart:845:9)
E/flutter (30457): #2 _JsonStringifier.writeJsonValue (dart:convert/json.dart:824:7)
E/flutter (30457): #3 _JsonStringifier.writeObject (dart:convert/json.dart:785:9)
E/flutter (30457): #4 _JsonStringStringifier.printOn (dart:convert/json.dart:983:17)
E/flutter (30457): #5 _JsonStringStringifier.stringify (dart:convert/json.dart:968:5)
E/flutter (30457): #6 JsonEncoder.convert (dart:convert/json.dart:345:30)
E/flutter (30457): #7 JsonCodec.encode (dart:convert/json.dart:231:45)
E/flutter (30457): #8 jsonEncode (dart:convert/json.dart:114:10)
E/flutter (30457): #9 SharedPreferencesManager.addApiResponse (package:chucker_flutter/src/helpers/shared_preferences_manager.dart:43:7)
E/flutter (30457):
E/flutter (30457): #10 ChuckerDioInterceptor._saveResponse (package:chucker_flutter/src/interceptors/dio_interceptor.dart:61:5)
E/flutter (30457):
E/flutter (30457): #11 ChuckerDioInterceptor.onResponse (package:chucker_flutter/src/interceptors/dio_interceptor.dart:38:5)
E/flutter (30457):
This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.
These updates have all been created already. Click a checkbox below to force a retry/rebase of any.
org.jetbrains.kotlin:kotlin-stdlib-jdk7
, org.jetbrains.kotlin:kotlin-gradle-plugin
)These are blocked by an existing closed PR and will not be recreated unless you click a checkbox below.
example/ios/Podfile
example/macos/Podfile
.github/workflows/build.yaml
actions/checkout v4
subosito/flutter-action v2
codecov/codecov-action v4.3.1
example/android/gradle.properties
example/android/settings.gradle
example/android/build.gradle
com.android.tools.build:gradle 7.4.2
org.jetbrains.kotlin:kotlin-gradle-plugin 1.9.10
org.jetbrains.kotlin:kotlin-stdlib-jdk7 1.9.10
example/android/app/build.gradle
example/android/gradle/wrapper/gradle-wrapper.properties
gradle 7.6.1
example/pubspec.yaml
dio ^5.0.3
http ^1.0.0
flutter
cupertino_icons ^1.0.2
chopper ^7.0.8
build_runner ^2.1.10
chopper_generator ^7.0.6
flutter_lints ^3.0.0
dart >=2.16.1 <3.0.0
pubspec.yaml
chopper ^7.0.8
dio ^5.0.3
flutter
http ^1.0.0
http_mock_adapter ^0.6.0
share_plus ^9.0.0
shared_preferences ^2.0.13
very_good_analysis ^5.0.0+1
dart >=2.16.0 <4.0.0
Describe the bug
Request detail is not using SafeArea
, so content is displayed under the navigation bar.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
A clear and concise description of what you expected to happen.
Version (please complete the following information):
Describe the bug
Got the error screen when i click popup chuck
To Reproduce
Steps to reproduce the behavior:
Unsupported operation: Cannot modify unmodifiable map
Version (please complete the following information):
update the intl package version to 0.18.1
Describe the bug
I am using auto route and Flutter Chucker navigator observer together. I am getting above issue. Following is my code
part of './main.dart';
class App extends StatelessWidget {
const App({super.key});
static final AppRouter appRouter = AppRouter(
authenticationRouteGuard: AuthenticationRouteGuard(),
);
// This widget is the root of your application.
@OverRide
Widget build(final BuildContext context) => MaterialApp.router(
title: 'title',
debugShowCheckedModeBanner: false,
routerDelegate: appRouter.delegate(
navigatorObservers: () => [
ChuckerFlutter.navigatorObserver,
MyObserver(),
AutoRouteObserver(),
],
),
routeInformationParser: appRouter.defaultRouteParser(),
builder: (
final BuildContext context,
final Widget? widget,
) =>
StreamChat(
client: (Injector.resolve() as ChatClient).client,
child: widget,
),
);
}
Describe the bug
There are corruptions in the Turkish characters returned in the response.
Expected behavior
{ name_surname= "Mustafa Yılmaz"}
Screenshots
This is the update request body;
This is the response from it
Version
[ERROR:flutter/lib/ui/ui_dart_state.cc(198)] Unhandled Exception: MissingPluginException(No implementation found for method getAll on channel plugins.flutter.io/shared_preferences)
Could you use hive? The docs and pub.dev say supports mac
Describe the bug
Error when sending a post request with a content type application/json. This is because request.bodyFields throws a state error StateError('Cannot access the body fields of a Request without '
'content-type "application/x-www-form-urlencoded".')
Log
[VERBOSE-2:ui_dart_state.cc(209)] Unhandled Exception: Read failed #0 IOClient.send (package:http/src/io_client.dart:66:7) <asynchronous suspension> #1 FailedRequestClient.send (package:sentry/src/http_client/failed_request_client.dart:109:24) <asynchronous suspension> #2 BreadcrumbClient.send (package:sentry/src/http_client/breadcrumb_client.dart:65:24) <asynchronous suspension> #3 ChuckerHttpClient.send (package:chucker_flutter/src/http/chucker_http_client.dart:60:22) <asynchronous suspension> #4 BaseClient._sendUnstreamed (package:http/src/base_client.dart:93:32) <asynchronous suspension>
Version
Flutter Version: 2.10.3
OS: IOS
Chucker Flutter Version : 1.2.0
This can be fixed by changing line 100 on chucker_http_client.dart from
requestBody = request.bodyFields;
to
requestBody = jsonDecode(request.body);
Hello there! First of all, thank you for creating such a great library.
I have a question regarding the JSON response created by chucker. There is an extra "data" key in every response. I thought it was from our backend, but turns out, it was added by the library.
{
"data": {
"is_success": true,
"status_code": "200",
"message": "success",
"data": {
"name": "KarmaServe",
"type": "store",
"notifications": [],
"configurations": {}
}
}
}
Is this intended? Any workaround to remove the additional "data" key? Since it can be misleading. Thank you 🙏
FormatException: Unexpected character (at character 1)
I got this error after calling a 404 status code expected API.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
It must show a 404 error in the console not stuck in the interceptor.
Version:
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.