solidart_lint 1.0.0 copy "solidart_lint: ^1.0.0" to clipboard
solidart_lint: ^1.0.0 copied to clipboard

solidart_lint is a developer tool for users of solidart, designed to help stop common issues and simplify repetitive tasks

example/lib/main.dart

// ignore_for_file: unused_local_variable

import 'package:flutter/material.dart';
import 'package:flutter_solidart/flutter_solidart.dart';

void main() {
  runApp(MyApp());
}

class MyClass {}

class MyApp extends StatelessWidget {
  MyApp({super.key});

  final counter = createSignal(1);

  @override
  Widget build(BuildContext context) {
    return Solid(
      providers: [
        // expect_lint: avoid_dynamic_solid_provider
        SolidProvider(create: () => MyClass()),
        // expect_lint: avoid_dynamic_solid_signal
        SolidSignal(create: () => createSignal(0), id: 'counter'),
        // expect_lint: avoid_dynamic_solid_signal
        SolidSignal(
          create: () => createComputed(() => counter() * 2),
          id: 'double-counter',
        ),
      ],
      child: const MaterialApp(
        title: 'Flutter Demo',
        home: MyHomePage(),
      ),
    );
  }
}

class MyHomePage extends StatelessWidget {
  const MyHomePage({super.key});

  @override
  Widget build(BuildContext context) {
    // expect_lint: missing_solid_get_type
    final myClass = context.get();
    // expect_lint: invalid_observe_type
    final counter = context.observe<Signal<int>>('counter');

    return ElevatedButton(
      child: const Text('Increment'),
      onPressed: () {
        // expect_lint: invalid_update_type
        context.update<Signal<int>>(
            (value) => throw UnimplementedError(), 'counter');
      },
    );
  }
}
15
likes
0
pub points
65%
popularity

Publisher

verified publishermariuti.com

solidart_lint is a developer tool for users of solidart, designed to help stop common issues and simplify repetitive tasks

Repository (GitHub)
View/report issues

Topics

#state-management #signals #linter

Documentation

Documentation

License

unknown (license)

Dependencies

analyzer, analyzer_plugin, collection, custom_lint_builder

More

Packages that depend on solidart_lint