flutter_easy_seo_sync 1.1.0 copy "flutter_easy_seo_sync: ^1.1.0" to clipboard
flutter_easy_seo_sync: ^1.1.0 copied to clipboard

Testing mocks, utilities & FastAPI server sync client for headless SEO HTML generation via WidgetTester. Companion dev_dependency for flutter_easy_seo.

flutter_easy_seo_sync #

License & Easy Server Setup:

Purpose #

Testing mocks, utilities & FastAPI server sync client for headless SEO HTML generation via WidgetTester. Companion dev_dependency for flutter_easy_seo.

Installation #

flutter pub add --dev flutter_easy_seo_sync

Features #

SEO Sync Service #

SEOSyncService pushes generated HTML pages and XML sitemaps to a backend API (e.g. the flutter_easy_seo_api server) via multipart HTTP requests.

final service = SEOSyncService(
  apiKey: 'your-api-key',
  apiUrl: 'https://seo-api.example.com',
  appName: 'my-app',
);

// Send a rendered HTML page for a given route
await service.sendGeneratedData(
  html: '<html>...</html>',
  path: '/blog/post-1',
);

// Send an XML sitemap
await service.sendSitemap(
  sitemapXmlContent: '<urlset>...</urlset>',
  filename: 'sitemap.xml',
);

// Send llms.txt and llms-full.txt
await syncService.sendLlms(
  llmsContent: "content of llms.txt",
  llmsFullContent: "content of llms-full.txt",
);

Set forceIOClient: true to bypass bad-certificate errors on localhost during local development with self-signed certificates.

Test Utilities #

testSeoWidgets

A drop-in replacement for testWidgets that automatically configures the test environment: suppresses overflow errors, sets a 1920x1080 viewport, opens a JSON cache repository, and tears everything down afterward.

testSeoWidgets('renders SEO tags correctly', (tester) async {
  await tester.pumpWidget(const MyApp());
  expect(find.byKey(const ValueKey('/home')), findsOneWidget);
});

waitForRoute

Waits until a widget with ValueKey(route) exists in the tree and EasySEOManager.instance.seoPageIsReady() returns true.

await waitForRoute('/blog/post-1', tester);

Pass an extraCheck callback for additional assertions:

await waitForRoute('/blog/post-1', tester, extraCheck: () {
  return EasySEOManager.instance.currentLang == 'en';
});

setRouteBeforePumpWidget

Injects a mock initial route before pumpWidget is called, simulating a browser opening at a specific URL.

setRouteBeforePumpWidget(tester, '/blog/post-1');
await tester.pumpWidget(const MyApp());

waitUntilReady

Polls a condition function until it returns true, stepping out of the fake-async zone on each iteration.

await waitUntilReady(tester, () => myService.isReady);

Mock Defaults #

EasySEOMockPlatformChannels

Registers all default mock platform channel handlers in a single call:

setUpAll(() {
  EasySEOMockPlatformChannels.useHeadlessDefaultMocks();
});

This mocks path_provider, connectivity_plus, and shared_preferences channels, and unblocks real network requests.

JsonCacheInfoRepository

A JSON-backed cache used internally by testSeoWidgets. Operates in-memory under flutter test to avoid left-over cached images on disk.

final repo = JsonCacheInfoRepository(databaseName: 'myCache');
await repo.open();
// ... run test ...
await repo.deleteDataFile();

API Reference #

Class / Function Description
SEOSyncService REST client for syncing SEO pages and sitemaps to a backend API
SEOSyncService.sendGeneratedData() Sends rendered HTML to the /generatedSEOPage endpoint
SEOSyncService.sendSitemap() Sends an XML sitemap to the /generatedSitemap endpoint
SEOSyncService.sendLlms() Sends llms.txt and llms-full.txt to the /generatedLlms endpoint
testSeoWidgets() Configured testWidgets replacement for SEO widget tests
waitForRoute() Waits for a route widget and SEO readiness
setRouteBeforePumpWidget() Injects a mock initial route before pumping
waitUntilReady() Polls a condition with real-async support
EasySEOMockPlatformChannels One-call setup for all default platform channel mocks
JsonCacheInfoRepository File-backed (or in-memory) JSON cache for test image data to avoid left-over cached images on disk

🛠️ Turnkey Backend & Infrastructure #

flutter_easy_seo and flutter_easy_seo_sync are 100% open-source software released under the Apache 2.0 License.

Need a low-maintenance server setup? We offer official 👉turnkey infrastructure stacks on Polar:

  • ⚡ Sync API ($79): Includes access to GitHub flutter_easy_seo_api:

    A FastAPI-based service designed to receive and store dynamically generated SEO HTML pages from a Flutter application using the flutter_easy_seo package. See README.md

  • 🐳 Docker Caddy Server ($249): Includes access to GitHub flutter_easy_seo_server:

    A turnkey Docker deployment stack that pairs Caddy 2 (automatic HTTPS, edge caching, bot detection) with flutter_easy_seo_api service to receive SEO-friendly HTML files. See README.md

Both grant instant, automated access to a unique license key (FEZSEO-...) and legal waiver clearance via Polar.

Our commercial server stacks are provided under the PolyForm Noncommercial License 1.0.0, with commercial production grants delivered upon purchase.

1
likes
150
points
185
downloads

Documentation

API reference

Publisher

verified publisherlxandr.at

Weekly Downloads

Testing mocks, utilities & FastAPI server sync client for headless SEO HTML generation via WidgetTester. Companion dev_dependency for flutter_easy_seo.

Repository (GitHub)
View/report issues

Topics

#seo #web #html #metadata #automation

License

Apache-2.0 (license)

Dependencies

flutter, flutter_easy_seo, flutter_test, http, http_parser, meta, path

More

Packages that depend on flutter_easy_seo_sync