The inspector for Refena.
Usage
Add the refena_inspector_client and refena_inspector packages to your project.
# pubspec.yaml
dependencies:
refena_inspector_client: <version>
dev_dependencies:
refena_inspector: <version>
Also add .refena_inspector
to your .gitignore
file.
# .gitignore
.refena_inspector/
Add the RefenaInspectorObserver
to your RefenaContainer
or RefenaScope
.
This observer will handle the communication between your app and the inspector.
void main() {
// or "RefenaScope" for Flutter projects
RefenaContainer(
observers: [
RefenaInspectorObserver(), // <-- Add this observer
RefenaTracingObserver(),
RefenaDebugObserver(),
],
);
}
Then start the inspector before your app is running:
dart run refena_inspector
Running the inspector afterwards also works, but it takes longer to connect.
You can configure the observer with custom actions:
RefenaInspectorObserver(
actions: {
'Test message': (Ref ref) => ref.message('test'),
'Authentication': {
'Register': InspectorAction(
params: {
'name': ParamSpec.string(required: true),
'age': ParamSpec.int(defaultValue: 20),
},
action: (ref, params) {
ref.message('Registering ${params['name']}');
},
),
'Logout': (Ref ref) => throw 'Logout error',
},
},
);
As you can see, you can use nested maps to create a tree of actions.
One action can be either a void Function(Ref)
or an InspectorAction
.
You should use InspectorAction
when you need to define parameters for the action.
Libraries
- main
- pages/home/actions_page
- pages/home/actions_page_vm
- pages/home/graph_page
- pages/home/redux_page
- pages/home/settings_page
- pages/home/tracing_page
- pages/home_page
- pages/home_page_controller
- pages/home_page_vm
- service/action_service
- service/graph_service
- service/server_service
- service/settings_service
- service/tracing_service
- theme
- util/logger
- util/regex