Skip to content

Latest commit

 

History

History
46 lines (32 loc) · 866 Bytes

useLogger.md

File metadata and controls

46 lines (32 loc) · 866 Bytes

useLogger

Flutter lifecycle hook that console logs parameters as component transitions through lifecycles.

Installation

dependencies:
  flutter_use: ^0.0.2

Usage

class Sample extends HookWidget {
  const Sample(this.user, {Key? key}) : super(key: key);

  final Map<String, dynamic> user;

  @override
  Widget build(BuildContext context) {

    useLogger('Sample', props: user);

    return Container();
  }
}

Example Output

Sample mounted {}
Sample updated {}
Sample unmounted

Reference

useLogger(componentName: string, props: map);
  • componentName: String - component name.
  • props: Map<String, dynamic> - parameters to log.