Refena Inspector | GitLocker.com Product

refena_inspector

Last updated:

0 purchases

refena_inspector Image
refena_inspector Images

Free

Languages

Categories

Add to Cart

Description:

refena inspector

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>
copied to clipboard
Also add .refena_inspector to your .gitignore file.
# .gitignore
.refena_inspector/
copied to clipboard
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(),
],
);
}
copied to clipboard
Then start the inspector before your app is running:
dart run refena_inspector
copied to clipboard
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',
},
},
);
copied to clipboard
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.

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product: (if this is empty don't purchase this product)

Customer Reviews

There are no reviews.