flutter_model_gen 1.1.1 copy "flutter_model_gen: ^1.1.1" to clipboard
flutter_model_gen: ^1.1.1 copied to clipboard

`flutter_model_gen` automates model class generation with `json_serializable`, `injectable`, and `get_it`, including DI setup for `clean architecture`

example/lib/main.dart

import 'package:flutter/material.dart';

import 'core/di/injection.dart';
import 'models/user.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  initDependencies();
  runApp(MyApp());
}

/// Initial Widget
class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'flutter_model_gen Example',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: ExamplePage(),
    );
  }
}

/// Actual Example of how the Controller is used inside a widget.
class ExamplePage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('flutter_model_gen Example'),
      ),
      body: Center(
        child: ElevatedButton(
          onPressed: () {
            // Example usage of your package
            var model = User(
              id: 1,
              name: 'full name',
              email: 'email',
            ); // Replace with actual usage of your package
            showDialog(
              context: context,
              builder: (context) => AlertDialog(
                content: Text('Generated Model: $model'),
              ),
            );
          },
          child: Text('Generate Model'),
        ),
      ),
    );
  }
}
1
likes
150
points
13
downloads

Publisher

unverified uploader

Weekly Downloads

`flutter_model_gen` automates model class generation with `json_serializable`, `injectable`, and `get_it`, including DI setup for `clean architecture`

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

injectable, json_annotation

More

Packages that depend on flutter_model_gen