Dart 3.5 enterprise development with Flutter 3.24, advanced async programming, state management, and cross-platform mobile development...
| Field | Value |
|---|---|
| Skill Name | moai-lang-dart |
| Version | 4.0.0 (2025-11-12) |
| Allowed tools | Read, Bash, Context7 MCP |
| Auto-load | On demand when keywords detected |
| Tier | Language Enterprise |
| Context7 Integration | ✅ Dart/Flutter/Async/StateManagement |
Dart 3.5 enterprise development featuring Flutter 3.24, advanced async programming patterns, modern state management (BLoC, Riverpod, Provider), and enterprise-grade cross-platform mobile development. Context7 MCP integration provides real-time access to official Dart and Flutter documentation.
Key capabilities:
Automatic triggers:
Manual invocation:
| Component | Version | Purpose | Status |
|---|---|---|---|
| Dart | 3.6.0 | Core language | ✅ Current |
| Flutter | 3.24.0 | UI framework | ✅ Current |
| Riverpod | 2.6.1 | State management | ✅ Current |
| BLoC | 8.1.6 | State management | ✅ Current |
| Dio | 5.6.0 | HTTP client | ✅ Current |
| Provider | 6.4.0 | State management | ✅ Current |
| Firebase Core | 2.28.0 | Backend | ✅ Current |
// Non-nullable by default
String name = 'Alice';
// Nullable with explicit ?
String? email;
// Late initialization
late String value;
// Null-coalescing operator
String display = email ?? 'No email';
// Safe navigation
int? length = email?.length;
// Modern async/await
Future<String> fetchData() async {
await Future.delayed(Duration(seconds: 1));
return 'Data';
}
// Stream for continuous values
Stream<int> counter() async* {
for (int i = 0; i < 5; i++) {
yield i;
}
}
// Error handling
try {
final data = await fetchData();
} catch (e) {
print('Error: $e');
}
// StatelessWidget - immutable UI
class MyWidget extends StatelessWidget {
@override
Widget build(BuildContext context) => Text('Hello');
}
// StatefulWidget - mutable state
class Counter extends StatefulWidget {
@override
State<Counter> createState() => _CounterState();
}
class _CounterState extends State<Counter> {
int count = 0;
@override
Widget build(BuildContext context) {
return FloatingActionButton(
onPressed: () => setState(() => count++),
child: Text('$count'),
);
}
}
Simple UI → setState
Single Feature → Provider / GetX
Complex App → Riverpod / BLoC
Enterprise Scale → BLoC + Repository Pattern
// Type safety ensures null checks at compile time
class User {
final String id;
final String? optionalEmail;
User({required this.id, this.optionalEmail});
// Safe method with null-coalescing
String getEmail() => optionalEmail ?? 'no-email@example.com';
// Null-aware property access
bool hasEmail() => optionalEmail?.isNotEmpty ?? false;
}
// Usage ensures type safety
final user = User(id: '1', optionalEmail: 'test@example.com');
print(user.getEmail()); // Type-safe string
print(user.hasEmail()); // Type-safe boolean
// Generator function for streams
Stream<String> dataStream() async* {
for (int i = 0; i < 5; i++) {
yield 'Item $i';
await Future.delayed(Duration(seconds: 1));
}
}
// Listening with error handling
dataStream().listen(
(value) => print(value),
onError: (error) => print('Error: $error'),
onDone: () => print('Complete'),
cancelOnError: false,
);
// Simple provider for state
class CounterProvider extends ChangeNotifier {
int _count = 0;
int get count => _count;
void increment() {
_count++;
notifyListeners();
}
}
// Using Provider in widget
Consumer<CounterProvider>(
builder: (context, counter, child) {
return Text('Count: ${counter.count}');
},
)
// Data layer abstraction
abstract class UserRepository {
Future<User> getUser(String id);
Future<void> saveUser(User user);
}
// Implementation
class UserRepositoryImpl implements UserRepository {
final apiClient = ApiClient();
@override
Future<User> getUser(String id) async {
final response = await apiClient.get('/users/$id');
return User.fromJson(response);
}
@override
Future<void> saveUser(User user) async {
await apiClient.post('/users', data: user.toJson());
}
}
// Composition-based widget tree
class AppScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('Title')),
body: ListView(
children: [
HeaderSection(),
ContentSection(),
FooterSection(),
],
),
);
}
}
User Input → Validation errors → Show in UI
Network Call → Timeout/connection → Retry with exponential backoff
Data Parse → Format errors → Log and use default
State Update → Concurrent updates → Use immutable state pattern
const constructors for immutable widgetsListView.builder instead of ListView for large listsRepaintBoundary for complex widget treessdk: '>=3.0.0')// Throwing unhandled exceptions
Future<Data> fetchData() async => apiCall(); // No error handling
// Memory leaks in streams
controller.stream.listen(...); // Not cancelled
// Mutable state in build()
int counter = 0; // Recreated on each build
// Handle errors gracefully
Future<Data> fetchData() async {
try { return await apiCall(); }
catch (e) { return Data.empty(); }
}
// Cancel subscriptions
StreamSubscription sub = stream.listen(...);
@override void dispose() { sub.cancel(); }
// Use State/Provider for mutable data
class Counter extends StatefulWidget { ... }
Official Documentation:
Learning:
Tools:
This skill integrates with Context7 MCP for real-time documentation:
Keyword Detection → Context7 Query → Real-Time API Docs
"async/await" → Dart async guide
"Flutter widget" → Flutter widget docs
"Riverpod" → Riverpod state management
"Firebase" → Firebase integration guide
Enable with: mcp__context7__resolve-library-id + mcp__context7__get-library-docs
| Version | Date | Status | Notes |
|---|---|---|---|
| 4.0.0 | 2025-11-12 | Current | Enterprise v4 restructure, Context7 integration |
| 3.5.4 | 2025-10-22 | Previous | Advanced patterns focus |
| 3.0.0 | 2025-09-01 | Legacy | Initial release |
For detailed examples → See examples.md
For API reference → See reference.md
For hands-on patterns → See examples.md Part 3-4