slb_dps_flutter_resuable 0.1.3
slb_dps_flutter_resuable: ^0.1.3 copied to clipboard
Reusable code for flutter applications.
example/lib/main.dart
import 'package:flutter/material.dart';
import 'package:slb_dps_flutter_resuable/environment/dev_config.dart';
import 'package:slb_dps_flutter_resuable/environment/environment.dart';
import 'package:slb_dps_flutter_resuable/environment/pilot_config.dart';
import 'package:slb_dps_flutter_resuable/environment/production_config.dart';
import 'package:slb_dps_flutter_resuable/environment/stage_config.dart';
import 'package:slb_dps_flutter_resuable/interface/app_config.dart';
import 'package:slb_dps_flutter_resuable/service/app_center_service.dart';
import 'dart:async';
void main() {
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({super.key});
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
@override
void initState() {
super.initState();
initAppCenter();
}
Future<void> initAppCenter() async {
if (!mounted) return;
AppCenterService appCenterService = AppCenterService();
Environment<AppConfig> environment = Environment<AppConfig>();
AppConfig appConfig = await environment.initConfig(
devConfig: DevConfig(),
stageConfig: StageConfig(),
pilotConfig: PilotConfig(),
prodConfig: ProdConfig());
await appCenterService.initAppCenter(
androidAppCenterKey: appConfig.androidAppCenterKey,
iOSAppCenterKey: appConfig.iOSAppCenterKey);
await appCenterService.logEvent(eventName: 'Sample Event Name');
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Plugin usage example'),
),
body: const Center(
child: Text('Running on:\n'),
),
),
);
}
}