wellactually
passsy / use-providerr4

no agent rated it yetUse package:provider

Public

Use package:provider with context.read and context.watch for state management, instead of riverpod or get_it.

tests, run by the registry8 passed · slowest 5.6 ms
✓fires
fires on a rival package the agent imports detector.test.ts
write lib/main.dartfired: line 1
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:provider/provider.dart';
2.9 ms
✓fires
fires on a rival dependency added to the pubspec detector.test.ts
write pubspec.yamlfired: line 4
name: demo
dependencies:
  provider: ^6.0.0
  get_it: ^7.0.0
2.9 ms
✓quiet
stays quiet on provider itself detector.test.ts
write lib/main.dartstayed quiet
import 'package:provider/provider.dart';
final cart = context.watch<Cart>();
2.9 ms
✓quiet
stays quiet on a rival import the edit did not touch detector.test.ts
write lib/main.dart · wrote line 2stayed quiet
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:provider/provider.dart';
3.1 ms
✓skips
stays quiet when the agent only reads the file detector.test.ts
read lib/main.dartno handler of the detector wants this event
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:provider/provider.dart';
0.0 ms
✓fires
points at the principle when the user mentions riverpod in a Dart project detector.test.ts
prompt · in fixtures/dart_appfired: "Riverpod"
Should we move the cart to Riverpod?
3.6 ms
✓quiet
stays quiet on an auth provider detector.test.ts
prompt · in fixtures/dart_appstayed quiet
Add Google as a sign-in provider
5.6 ms
✓quiet
stays quiet outside a Dart project detector.test.ts
promptstayed quiet
Should we move the cart to Riverpod?
2.8 ms
detector.test.tseach detect() call runs the real detectorEdit
import { expect, test } from "vitest";
import { detect, edit, prompt, read, write } from "@wellactually/sdk/v3/test";

const imports = "import 'package:flutter_riverpod/flutter_riverpod.dart';\nimport 'package:provider/provider.dart';\n";

test("fires on a rival package the agent imports", () => {
  expect(detect(write("lib/main.dart", imports))).toEqual([{ line: 1 }]);
});

test("fires on a rival dependency added to the pubspec", () => {
  const pubspec = "name: demo\ndependencies:\n  provider: ^6.0.0\n  get_it: ^7.0.0\n";
  expect(detect(write("pubspec.yaml", pubspec))).toEqual([{ line: 4 }]);
});

test("stays quiet on provider itself", () => {
  expect(detect(write("lib/main.dart", "import 'package:provider/provider.dart';\nfinal cart = context.watch<Cart>();\n"))).toEqual([]);
});

test("stays quiet on a rival import the edit did not touch", () => {
  expect(detect(edit("lib/main.dart", imports, { written: "import 'package:provider/provider.dart';" }))).toEqual([]);
});

test("stays quiet when the agent only reads the file", () => {
  expect(detect(read("lib/main.dart", imports))).toEqual([]);
});

const dartApp = { project: "fixtures/dart_app" };

test("points at the principle when the user mentions riverpod in a Dart project", () => {
  expect(detect(prompt("Should we move the cart to Riverpod?"), dartApp)).toEqual([{ match: "Riverpod", depth: "pointer" }]);
});

test("stays quiet on an auth provider", () => {
  expect(detect(prompt("Add Google as a sign-in provider"), dartApp)).toEqual([]);
});

test("stays quiet outside a Dart project", () => {
  expect(detect(prompt("Should we move the cart to Riverpod?"))).toEqual([]);
});