fanoos_project 1.0.0
fanoos_project: ^1.0.0 copied to clipboard

A package to make complicated flutter projects without spgetti code.

example/main.dart

import 'package:fanoos_project/fanoos_project.dart';
import 'package:flutter/material.dart';

ServiceContainer serviceContainer = ServiceContainer({
  LoggerService(),
});

void main() async {
  await serviceContainer.runAll();
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: Center(
          child: FlatButton(
            onPressed: () {
              Services.get<LoggerService>(context).log('button pressed');
            },
            child: Text('just a normal button'),
          ),
        ),
      ),
    );
  }
}

class LoggerService extends AppService {
  @override
  Future<void> run(ServiceContainer services) async {
    print('Logger service initiated!');
  }

  void log(String s) {
    print(s);
  }
}
1
likes
120
pub points
30%
popularity

A package to make complicated flutter projects without spgetti code.

Repository (GitHub)
View/report issues

Documentation

API reference

Uploader

ali.gh2236@gmail.com

License

MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on fanoos_project