This document provides guidance for AI coding agents working on the Vernet repository. The goal is to help agents understand how to safely modify the project and where to place new functionality.
Vernet is a cross-platform network diagnostics application built with Flutter.
Supported platforms: - Android - iOS - Linux - macOS - Windows - Web
The application provides tools such as: - Device discovery - Port scanning - DNS lookup - Network diagnostics - Internet speed testing
All primary application logic resides in the lib/ directory.
All coverage related files inside coverage/ directory
The project follows a layered architecture:
UI Layer ↓ Feature Screens ↓ Service Layer ↓ Network Utilities
Important rule: UI must never perform network operations directly. All network logic must go through the service layer.
lib/ ├── main.dart ├── pages/ ├── widgets/ ├── services/ ├── models/ ├── utils/ ├── providers/ └── routing/
Directory purposes:
pages → UI pages for each tool
widgets → reusable UI components
services → networking logic
models → data structures
utils → helper functions
providers → state management
routing → navigation configuration
When adding a new network tool:
- Create UI screen in
lib/pages/ - Create service in
lib/services/ - Create data models in
lib/models/if needed - Connect UI to the service layer
Example structure:
lib/pages/ping_page/ lib/services/ping_service.dart lib/models/ping_result.dart
UI components should:
- remain stateless where possible
- delegate logic to services
- reuse components from
widgets/
Avoid placing network or heavy logic inside widgets.
Networking operations must live inside services/.
Examples:
lib/services/network_scanner/ lib/services/port_scanner/ lib/services/dns_tools/ lib/services/speedtest/
Services should:
- return structured models
- avoid UI dependencies
- be reusable across screens
State should remain local to features.
Preferred approaches:
- Provider
- Riverpod
- simple StatefulWidget state
Avoid global mutable state unless necessary.
All structured data must live in models/.
Examples:
- Device
- PortResult
- DnsResult
- SpeedTestResult
Models should:
- be immutable when possible
- support JSON serialization if needed
When modifying code:
UI change → modify pages/ or widgets/
Network feature → modify services/
Data structure → modify models/
Utility function → modify utils/
Never mix UI logic and network operations.
Platform specific implementations exist in:
android/ ios/ linux/ macos/ windows/
Agents should avoid modifying these unless absolutely necessary.
Most functionality should be implemented in Flutter/Dart.
Unit tests live in:
test/
Integration tests live in:
integration_test/
Coverage folder
coverage/
Combined unit test file
coverage/lcov.info
Agents adding new functionality should add tests when possible.
Dependencies are defined in:
pubspec.yaml
When adding dependencies:
- prefer lightweight packages
- avoid redundant libraries
- maintain cross-platform compatibility
Agents should:
- reuse existing services
- maintain separation of concerns
- keep functions small and focused
- prefer composition over duplication
To implement a new feature:
- Create service for network logic
- Define model for results
- Create UI screen
- Connect screen to service
- Add widgets for display
The most important rules:
- UI in
pages/ - Reusable components in
widgets/ - Networking in
services/ - Data structures in
models/ - Helpers in
utils/ - Coverage in
coverage/
Maintaining this separation ensures the project remains maintainable and scalable.
Always read ARCHITECTURE.md before making structural changes. Use it as the source of truth for system design.