ig_module_dart 0.0.3 copy "ig_module_dart: ^0.0.3" to clipboard
ig_module_dart: ^0.0.3 copied to clipboard

Itgee module for dart

example/main.dart

import 'package:ig_module_dart/ig_module_dart.dart';

import 'lib/config/example.dart';

// access to direct functions
class FullAccess {
  void run() {
    // context
    MContext context = MContext();
    print("context >> $context");

    // config
    const name = "example";
    final configOption = MConfigOption.init(
      env: "local-dev",
      configPath: "example/configs",
      configName: name,
    );
    print("init option >> ${configOption.getConfigFilePath() ?? ""}");

    MConfig config = MConfig.load(option: configOption);
    print("load config >> ${config.config}");

    // load config
    MEnvironmentConfig envConfig = MEnvironmentConfig.fromConfig(config: config);
    print("envConfig >> $envConfig");

    MGrpcClientConfig grpcClientConfig = MGrpcClientConfig.fromConfig(config: config);
    print("grpcClientConfig >> $grpcClientConfig");

    // grpc
    MGrpcClient grpcClient = MGrpcClient.load(config: grpcClientConfig);
    context.set(contextGrpcClient, grpcClient);

    print("context >> ${context}");
  }
}

// application format
class Application{
  void run() {

    // option
    final option = MApplicationOption(
      applicationName: "example",
      environment: "local-dev",
      configPath: "example/configs", // option
      plugin: MApplicationPluginOption(
        grpcClient: true,
      ),
    );

    // program config
    ConfigWrap(option: option);
    if (config == null) {
      throw "invalid config";
    }

    final MApplication app = MApplication(
      config: config!.applicationConfig,
    );

    print("context >> ${app.context}");
  }
}

void main() {
  print("start main");

  // fullAccess();
  Application().run();
}
1
likes
120
points
30
downloads

Publisher

verified publisheritgee.kr

Weekly Downloads

Itgee module for dart

Homepage
Repository

Documentation

API reference

License

MIT (license)

Dependencies

grpc, yaml

More

Packages that depend on ig_module_dart