Giter Club home page Giter Club logo

chucker-flutter's People

Contributors

dammyololade avatar fachrifaul avatar navneet-coditas avatar renovate[bot] avatar serproger avatar syedmurtaza108 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

chucker-flutter's Issues

chucker pop up shows multiple times on one endpoint hit

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:

  1. Upgrade flutter 3.7.0 to 3.10.0
  2. Upgrade chucker 1.6.0 to 1.6.3

Expected behavior
Show only one pop up on one endpoint hit

Version (please complete the following information):

  • Flutter Version: 3.10.0
  • OS: Android
  • Chucker Flutter Version : 1.6.3

Unhandled Exception: Converting object to an encodable object failed: Instance of 'ApiResponse' (Dio)

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):

  • Flutter Version: 2.10.4
  • OS: Android
  • Chucker Flutter Version : 1.1.4

Chucker Flutter break some characters

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:

  1. Clone this repo example
  2. Replace main.dart in example folder with this code
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,
}
  1. Click GET special character using Chucker Interceptor button
  2. See error

Expected behavior
Return HTTP response as original HTTP Client did

Screenshots
Using interceptor
alt text

Version (please complete the following information):

  • Flutter Version: all
  • OS: all
  • Chucker Flutter Version : 1.5.2

Chucker toast is RenderFlex overflowed on long api url

Describe the bug
Chucker toast is renderflex overflowed so I couldn't click the details button

To Reproduce
Steps to reproduce the behavior:

  1. Use long api url
  2. See error

Expected behavior
image

Screenshots
telegram-cloud-photo-size-5-6140747019673775749-y

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

[Request] Add initial settings

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...)

Update dependencies.

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.

error when reponse body is empty

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):

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Ignored or Blocked

These are blocked by an existing closed PR and will not be recreated unless you click a checkbox below.

Detected dependencies

cocoapods
example/ios/Podfile
example/macos/Podfile
github-actions
.github/workflows/build.yaml
  • actions/checkout v4
  • subosito/flutter-action v2
  • codecov/codecov-action v4.3.1
gradle
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
gradle-wrapper
example/android/gradle/wrapper/gradle-wrapper.properties
  • gradle 7.6.1
pub
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

  • Check this box to trigger a request for Renovate to run again on this repository

Add `SafeArea` to request details

Describe the bug
Request detail is not using SafeArea, so content is displayed under the navigation bar.

To Reproduce
Steps to reproduce the behavior:

  1. Go to a network request details with long content
  2. Scroll to the bottom
  3. Last item can't be clicked because it's under the navigation bar

Expected behavior
A clear and concise description of what you expected to happen.

Version (please complete the following information):

  • Flutter Version: 3.7.8
  • OS: Android/iOS
  • Chucker Flutter Version : 1.4.3
Screenshots

image

Unsupported operation: Cannot modify unmodifiable map

Describe the bug
Got the error screen when i click popup chuck

To Reproduce
Steps to reproduce the behavior:

  1. hit api
  2. show your pop up chuck
  3. click popup
  4. crash Unsupported operation: Cannot modify unmodifiable map

Screenshots
Screen Shot 2022-06-30 at 16 38 41

Version (please complete the following information):

  • Flutter Version: [e.g. v2.10.4]
  • OS: [e.g. iOS/Android]
  • Chucker Flutter Version : [e.g. 1.3.2]

'package:flutter/src/widgets/navigator.dart': Failed assertion: line 3418 pos 14: 'observer.navigator == null': is not true.

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

Turkish characters in response corrupt

Describe the bug
There are corruptions in the Turkish characters returned in the response.

Expected behavior
{ name_surname= "Mustafa Yılmaz"}
Screenshots
tr_chars

This is the update request body;
update_request_body

This is the response from it

response

Version

  • Flutter 3.7.6 • channel stable
    Dart 2.19.3
  • OS: iOS/Android
  • chucker_flutter: ^1.4.3

Unhandled Exception: Read failed when accessing request.bodyFields for request with Content type application/json

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

Extra "data" in the response

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)

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:

  1. Call this API https://fakestoreapi.com/productsk using dio

Expected behavior
It must show a 404 error in the console not stuck in the interceptor.

Screenshots
Screenshot 2023-04-15 at 3 06 52 AM

Version:

  • Flutter Version: 3.7.11
  • OS: Android
  • Chucker Flutter Version: 1.5.0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.