fwdebug_flutter

Flutter debugging libraray, wrapper for talker_flutter, inspector, FWDebug and so on, to facilitate development and testing.

Screenshot

Getting Started

By default, fwdebug_flutter is available in all modes. If you want to enable it only in debug mode, you can set it at startup as follows:

FwdebugFlutter.isEnabled = kDebugMode;

In addition, in order to make iOS FWDebug only effective in debug mode, you need to add the following code between target 'Runner' do and end in ios/Podfile:

pod 'FWDebug', :configurations => ['Debug']

1. inspector

Initialize the fwdebug_flutter inspector, for example:

Widget build(BuildContext context) {
  return MaterialApp(
    ...
    builder: (context, child) {
      return FwdebugFlutter.inspector(child: child!);
    },
  );
}

2. navigatorObserver

Register the fwdebug_flutter navigatorObserver, for example:

Widget build(BuildContext context) {
  return MaterialApp(
    ...
    navigatorObservers: [FwdebugFlutter.navigatorObserver],
  );
}

3. intercept

Forward Dio requests to fwdebug_flutter, for example:

final dio = Dio();
FwdebugFlutter.intercept(dio);
// dio.interceptors.add(FwdebugFlutter.interceptor);

4. riverpodObserver

Register the fwdebug_flutter riverpodObserver, for example:

runApp(ProviderScope(
  observers: [FwdebugFlutter.riverpodObserver],
  child: const MyApp(),
));

5. blocObserver

Register the fwdebug_flutter blocObserver, for example:

Bloc.observer = FwdebugFlutter.blocObserver;

6. systemLog

Record logs to fwdebug_flutter, for example:

FwdebugFlutter.debug('This is a system debug log');
// FwdebugFlutter.info('This is a system info log');
// FwdebugFlutter.warning('This is a system warning log');
// FwdebugFlutter.error('This is a system error log', group: 'test');
// FwdebugFlutter.systemLog('This is a system debug log', group: 'test');

7. customLog

Record custom logs to fwdebug_flutter, for example:

FwdebugFlutter.customLog('This is a custom debug log');
// FwdebugFlutter.customLog('This is a custom info log', level: LogLevel.info);
// FwdebugFlutter.customLog('This is a custom warning log', level: LogLevel.warning, group: 'test');
// FwdebugFlutter.customLog('This is a custom error log', level: LogLevel.error, group: 'test');

8. toggle

Toggle fwdebug_flutter to show or hide, for example:

FwdebugFlutter.toggle();

9. registerEntry

Register custom entry to fwdebug_flutter, for example:

FwdebugFlutter.registerEntry(
    'entry',
    GestureDetector(
        onTap: () { ... }, 
        child: Icon(icon, color: Colors.blue, size: 20),
    ),
);

10. registerInfo

Register custom info to fwdebug_flutter, for example:

FwdebugFlutter.registerInfo('custom', () { ... });

11. registerUrl

Register custom url to fwdebug_flutter, for example:

FwdebugFlutter.registerUrl('/custom');
// FwdebugFlutter.registerUrl('/custom', (url) { ... });

12. openUrl

Register opening URL of fwdebug_flutter, for example:

FwdebugFlutter.openUrl((url) { ... });

Libraries

fwdebug_flutter