Closed Ram8948 closed 1 year ago
@Ram8948 The code shown in the question is incomplete.
Please add complete code here (e.g. where exactly you are calling _dio.get('$_baseUrl$path');
).
Also plz mention chucker version and flutter version here.
@syedmurtaza108 syedmurtaza108 Sir Here is my complete code with the chucker version and flutter version: chucker_flutter: ^1.3.6 Flutter version: 3.3.9
class UserSearch extends StatefulWidget { UserSearch({Key? key}) : super(key: key);
@override
State
class _UserSearchState extends State
late final _dio = Dio( BaseOptions( baseUrl: 'https://api.github.com/', sendTimeout: const Duration(seconds: 50).inMilliseconds, connectTimeout: const Duration(seconds: 50).inMilliseconds, receiveTimeout: const Duration(seconds: 50).inMilliseconds, ), );
@override void initState() { super.initState(); BaseOptions options = BaseOptions(baseUrl: 'https://api.github.com/'); dio = Dio(options); _dio.interceptors.add(ChuckerDioInterceptor()); }
Future
@override Widget build(BuildContext context) { return Scaffold( appBar: isSearching ? AppBar( // The search area here backgroundColor: Colors.black, title: Container( width: double.infinity, height: 40, decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(5)), child: Center( child: TextField( onChanged: (word) { if (word != '') { _debouncer.run(() => (getUser(word))); print('kelime $word'); } }, decoration: InputDecoration( prefixIcon: const Icon(Icons.search), suffixIcon: IconButton( icon: const Icon(Icons.clear), onPressed: () { setState(() { isSearching = false; isLoading = false; }); }, ), hintText: 'Search...', border: InputBorder.none), ), ), )) : AppBar( backgroundColor: Colors.black, title: const Text('Search User'), actions: [ IconButton( onPressed: () { setState(() { isSearching = true; }); }, icon: const Icon(Icons.search)) ]), body: isLoading == true ? Container( alignment: Alignment.center, color: Colors.black, child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ SizedBox( width: 300, height: 300, child: LiquidCircularProgressIndicator( value: 0.7, center: Text( 'Loading..', style: TextStyle(fontSize: 20, color: Colors.white), ), backgroundColor: Colors.white, ), ) ], ), ) : errorMessage != null || user?.name == null ? SorryWidget() : UserPage( user: user, )); } }
@Ram8948 Have you added NavigatorObserver
in your MaterialApp
widget, commonly placed in main.dart
?
MaterialApp(
...,
navigatorObservers: [ChuckerFlutter.navigatorObserver],
@syedmurtaza108 Sir i have added this one also
class MyApp extends StatelessWidget { const MyApp({Key? key}) : super(key: key);
// This widget is the root of your application. @override Widget build(BuildContext context) { return MaterialApp( title: 'Flutter Demo', navigatorObservers: [ChuckerFlutter.navigatorObserver], debugShowCheckedModeBanner: false, theme: ThemeData( primarySwatch: Colors.blue, ), onGenerateRoute: Routes.generateRoute, home: UserSearch()); } }
Hii @syedmurtaza108 Sir,
it's working fine actually the notification box is hiding below the keyboard. I have checked on the web and mobile also.
@Ram8948 Oh okay. Thanks for letting me know.
https://stackoverflow.com/questions/74714788/chucker-flutter-why-chucker-not-showing-notification