You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

68 lines
1.5KB

  1. import 'app_environment.dart';
  2. class FlavorValues {
  3. FlavorValues({
  4. required this.server,
  5. required this.baseUrl,
  6. required this.appName,
  7. required this.LocalDBName,
  8. });
  9. final String server;
  10. final String baseUrl;
  11. final String appName;
  12. final String LocalDBName;
  13. }
  14. abstract class FlavorConfig {
  15. static AppEnvironment? _flavor;
  16. static FlavorValues? _values;
  17. static void set(AppEnvironment flavor, FlavorValues values) {
  18. _flavor = flavor;
  19. _values = values;
  20. }
  21. static bool isInitialized() => _flavor != null;
  22. static bool isDev() => _flavor! == AppEnvironment.DEV;
  23. static bool isProduction() => _flavor! == AppEnvironment.PROD;
  24. static FlavorValues get values => _values!;
  25. }
  26. void setFlavorDevelopment() {
  27. FlavorConfig.set(
  28. AppEnvironment.DEV,
  29. FlavorValues(
  30. appName: 'LaFarm',
  31. server: 'https://tpf.aztrace.vn',
  32. baseUrl: 'https://tpf.aztrace.vn',
  33. LocalDBName: 'AppLocalStorage',
  34. ),
  35. );
  36. }
  37. void setFlavorOutsourceDevelopment() {
  38. FlavorConfig.set(
  39. AppEnvironment.DEV,
  40. FlavorValues(
  41. appName: 'LaFarm',
  42. server: 'https://tpf.aztrace.vn/',
  43. baseUrl: 'https://tpf.aztrace.vn/',
  44. LocalDBName: 'AppLocalStorage',
  45. ),
  46. );
  47. }
  48. void setFlavorProduction() {
  49. FlavorConfig.set(
  50. AppEnvironment.PROD,
  51. FlavorValues(
  52. appName: 'Trang Trai Bo',
  53. server: 'https://test-trangtraibo.aristqnu.com/',
  54. baseUrl: 'https://test-trangtraibo.aristqnu.com/',
  55. LocalDBName: 'AppLocalStorage',
  56. ),
  57. );
  58. }