flutter_version
Retrieve Flutter SDK version details to verify compatibility and manage mobile development environments.
Instructions
Get Flutter SDK version information
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/flutter.ts:283-334 (registration)Registration of the 'flutter_version' tool within the createFlutterTools function. Includes name, description, empty input schema (no parameters), and the complete handler logic that executes the Flutter version command with machine-readable output preference, JSON parsing, and human-readable fallbacks.tools.set('flutter_version', { name: 'flutter_version', description: 'Get Flutter SDK version information', inputSchema: { type: 'object', properties: {}, required: [] }, handler: async () => { const result = await processExecutor.execute('flutter', ['--version', '--machine']); if (result.exitCode !== 0) { // Try fallback without --machine flag const fallbackResult = await processExecutor.execute('flutter', ['--version']); return { success: true, data: { machineOutput: null, humanOutput: fallbackResult.stdout, rawExitCode: result.exitCode, }, }; } // Parse machine output if available let parsedOutput = null; try { parsedOutput = JSON.parse(result.stdout); } catch { // Fallback to human readable const humanResult = await processExecutor.execute('flutter', ['--version']); return { success: true, data: { machineOutput: null, humanOutput: humanResult.stdout, rawExitCode: result.exitCode, }, }; } return { success: true, data: { machineOutput: parsedOutput, rawOutput: result.stdout, exitCode: result.exitCode, }, }; } });
- src/tools/flutter.ts:291-333 (handler)The core handler function implementing the flutter_version tool logic. Executes 'flutter --version --machine', handles non-zero exit codes with fallback to plain 'flutter --version', parses JSON output when available, and returns structured data with machineOutput, humanOutput, and status information.handler: async () => { const result = await processExecutor.execute('flutter', ['--version', '--machine']); if (result.exitCode !== 0) { // Try fallback without --machine flag const fallbackResult = await processExecutor.execute('flutter', ['--version']); return { success: true, data: { machineOutput: null, humanOutput: fallbackResult.stdout, rawExitCode: result.exitCode, }, }; } // Parse machine output if available let parsedOutput = null; try { parsedOutput = JSON.parse(result.stdout); } catch { // Fallback to human readable const humanResult = await processExecutor.execute('flutter', ['--version']); return { success: true, data: { machineOutput: null, humanOutput: humanResult.stdout, rawExitCode: result.exitCode, }, }; } return { success: true, data: { machineOutput: parsedOutput, rawOutput: result.stdout, exitCode: result.exitCode, }, }; }
- src/tools/flutter.ts:286-290 (schema)Input schema for flutter_version tool: empty object schema as the tool requires no input parameters.inputSchema: { type: 'object', properties: {}, required: [] },
- src/utils/tool-categories.ts:60-68 (helper)Metadata registration for flutter_version in the global TOOL_REGISTRY, categorizing it as essential Flutter tool requiring FLUTTER, safe for testing with performance expectations.'flutter_version': { name: 'flutter_version', category: ToolCategory.ESSENTIAL, platform: 'flutter', requiredTools: [RequiredTool.FLUTTER], description: 'Get Flutter SDK version information', safeForTesting: true, performance: { expectedDuration: 200, timeout: 10000 } },