solidart_lint

Creator: coderz1093

Last updated:

0 purchases

TODO
Add to Cart

Description:

solidart lint

This package is a developer tool for users of flutter_solidart, designed to help stop common issues and simplify repetitive tasks.

I highly recommend using this package to avoid errors and understand how to properly use flutter_solidart

Getting started #
Run this command in the root of your Flutter project:
flutter pub add -d solidart_lint custom_lint
copied to clipboard
Then edit your analysis_options.yaml file and add these lines of code:
analyzer:
plugins:
- custom_lint
copied to clipboard
Then run:
flutter clean
flutter pub get
dart run custom_lint
copied to clipboard
ASSISTS #
Wrap with Solid #

Wrap with SignalBuilder #

Wrap with ResourceBuilder #

Wrap with Show #

LINTS #
avoid_dynamic_solid_provider #
Provider cannot be dynamic
Bad:
Solid(
providers: [
Provider(create: () => MyClass()),
],
),
copied to clipboard
Good:
Solid(
providers: [
Provider<MyClass>(create: () => MyClass()),
],
),
copied to clipboard

avoid_dynamic_solid_signal #
Solid signals cannot be dynamic
Bad:
Solid(
signals: {
'id': () => Signal(0),
},
),
copied to clipboard
Good:
Solid(
signals: {
'id': () => Signal<int>(0),
},
),
copied to clipboard

invalid_provider_type #
The provider type you want to retrieve is invalid, must not implement SignalBase.
You cannot retrieve a provider that implements SignalBase, like Signal, ReadSignal and Resource.
Bad:
final provider = context.get<Signal<MyClass>>();
copied to clipboard
Good:
final provider = context.get<MyClass>();
copied to clipboard

invalid_signal_type #
The signal type you want to retrieve is invalid, must implement SignalBase.
You can retrieve signals that implement SignalBase, like Signal, ReadSignal and Resource.
Bad:
final signal = context.get<MyClass>('signal-id');
copied to clipboard
Good:
final signal = context.get<Signal<int>>('signal-id');
copied to clipboard

invalid_solid_get_type #
Specify the provider or signal type you want to get.
Bad:
final provider = context.get();
copied to clipboard
Good:
final provider = context.get<MyClass>();
copied to clipboard

invalid_observe_type #
The type you want to observe is invalid, must not implement SignalBase.
You cannot observe a signal that implements SignalBase, like Signal, ReadSignal and Resource.
Bad:
final counter = context.observe<Signal<int>>('counter');
copied to clipboard
Good:
final counter = context.observe<int>('counter');
copied to clipboard

invalid_update_type #
The update type is invalid, must not implement SignalBase.
You cannot update a signal that implements SignalBase, like Signal, ReadSignal and Resource.
Bad:
context.update<Signal<int>>('counter', (value) => value * 2);
copied to clipboard
Good:
context.update<int>('counter', (value) => value * 2);
copied to clipboard

License

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

Files:

Customer Reviews

There are no reviews.