refena_inspector_client 0.5.0 copy "refena_inspector_client: ^0.5.0" to clipboard
refena_inspector_client: ^0.5.0 copied to clipboard

The client for the inspector of the Refena state management library.

example/refena_inspector_client_example.dart

import 'package:refena/refena.dart';
import 'package:refena_inspector_client/refena_inspector_client.dart';

/// Run this main function,
/// then run the inspector server with the following command:
/// `dart run refena_inspector`
void main() {
  // or "RefenaScope" for Flutter projects
  RefenaContainer(
    observers: [
      RefenaInspectorObserver(
        host: 'localhost',
        actions: {
          'Test message': (Ref ref) => ref.message('test'),
          'Authentication': {
            'Login': InspectorAction(
              params: {
                'name': ParamSpec.string(),
                'password': ParamSpec.string(),
              },
              action: (ref, params) {
                ref.message(
                  'Login with ${params['name']} and ${params['password']}',
                );
              },
            ),
            'Register': InspectorAction(
              params: {
                'name': ParamSpec.string(required: true),
                'age': ParamSpec.int(defaultValue: 20),
                'height': ParamSpec.double(required: true),
                'premium': ParamSpec.bool(defaultValue: false),
              },
              action: (ref, params) {
                ref.message(
                  'Register with name: ${params['name']}, age: ${params['age']}, height: ${params['height']}, premium: ${params['premium']}',
                );
              },
            ),
            'Logout': (Ref ref) => throw 'Logout error',
            'Admin': {
              'Test': {
                'Hello': (Ref ref) => ref.message('Hello'),
                'World': (Ref ref) => ref.message('World'),
              }
            },
          },
        },
      ),
      RefenaTracingObserver(),
      RefenaDebugObserver(),
    ],
  );
}
0
likes
0
pub points
81%
popularity

Publisher

verified publisherrefena.dev

The client for the inspector of the Refena state management library.

Repository (GitHub)
View/report issues

Topics

#refena

License

unknown (license)

Dependencies

meta, refena, web_socket_channel

More

Packages that depend on refena_inspector_client