flap library
flap — OpenAPI → Dart/Flutter client generator.
Most users should interact with the flap command-line tool:
dart pub global activate flap
flap --out ./sdks path/to/petstore.yaml
FlapRunner is also exposed for programmatic use (e.g. in build scripts):
import 'package:flap/flap.dart';
Future<void> main() async {
final code = await FlapRunner().run([
'--out', './generated',
'--client=http',
'api/openapi.yaml',
]);
if (code != 0) throw Exception('flap exited with code $code');
}
Set the FLAP_BINARY environment variable to use a locally built
generator instead of the downloaded release binary.
Classes
- BinaryManager
-
Locates the pre-built
flapnative binary, downloading it from GitHub Releases on first use and caching it in~/.flap/bin/<version>/. - FlapRunner
-
Locates the
flapnative binary and runs it withargs, streaming stdout/stderr directly to the parent terminal in real time.
Constants
- flapBinaryEnv → const String
-
Environment variable that points at a locally built
flapbinary, bypassing the download entirely (useful for development and CI). - packageVersion → const String
- The version of this package.