Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Offline mode #51

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/src/constants/command_constants.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/// Stores all the commands used throughout the app that
library;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why has this been added?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Auto added by linter.

linter: "Dangling library doc comment. Add a 'library' directive after the library comment."

has no effect other than for the auto generated API reference (not sure what the difference is though). Would change the above comment to "//" or keep library.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

guessing it means the file will be added under "Libraries" in the attached picture with all constants documented.
Skärmbild 2024-12-13 005419


const String ksDart = 'dart';
const String ksFlutter = 'flutter';
Expand All @@ -11,6 +12,7 @@ const String ksBuild = 'build';
const String ksBuildRunner = 'build_runner';
const String ksDeleteConflictOutputs = 'delete-conflicting-outputs';
const String ksDeleteConflictingOutputs = '--delete-conflicting-outputs';
const String ksNoPubGet = '--no-pub';
const String ksVersion = 'version';
const String ksEnableAnalytics = 'enable-analytics';
const String ksDisableAnalytics = 'disable-analytics';
Expand Down
3 changes: 3 additions & 0 deletions lib/src/models/config_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ class Config with _$Config {
/// the code.
@JsonKey(name: 'line_length') @Default(80) int lineLength,
@JsonKey(name: 'prefer_web') @Default(false) bool preferWeb,

/// Boolean value determining if build_runner should run pub get.
@JsonKey(name: 'offline_mode') @Default(false) bool offlineMode,
}) = _Config;

factory Config.fromJson(Map<String, dynamic> json) => _$ConfigFromJson(json);
Expand Down
145 changes: 95 additions & 50 deletions lib/src/models/config_model.freezed.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ part of 'config_model.dart';
T _$identity<T>(T value) => value;

final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods');
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');

Config _$ConfigFromJson(Map<String, dynamic> json) {
return _Config.fromJson(json);
Expand Down Expand Up @@ -101,8 +101,16 @@ mixin _$Config {
@JsonKey(name: 'prefer_web')
bool get preferWeb => throw _privateConstructorUsedError;

/// Boolean value determining if build_runner should run pub get.
@JsonKey(name: 'offline_mode')
bool get offlineMode => throw _privateConstructorUsedError;

/// Serializes this Config to a JSON map.
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
@JsonKey(ignore: true)

/// Create a copy of Config
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$ConfigCopyWith<Config> get copyWith => throw _privateConstructorUsedError;
}

Expand Down Expand Up @@ -132,7 +140,8 @@ abstract class $ConfigCopyWith<$Res> {
@JsonKey(name: 'register_mocks_function') String registerMocksFunction,
@JsonKey(name: 'v1') bool v1,
@JsonKey(name: 'line_length') int lineLength,
@JsonKey(name: 'prefer_web') bool preferWeb});
@JsonKey(name: 'prefer_web') bool preferWeb,
@JsonKey(name: 'offline_mode') bool offlineMode});
}

/// @nodoc
Expand All @@ -145,6 +154,8 @@ class _$ConfigCopyWithImpl<$Res, $Val extends Config>
// ignore: unused_field
final $Res Function($Val) _then;

/// Create a copy of Config
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Expand All @@ -167,6 +178,7 @@ class _$ConfigCopyWithImpl<$Res, $Val extends Config>
Object? v1 = null,
Object? lineLength = null,
Object? preferWeb = null,
Object? offlineMode = null,
}) {
return _then(_value.copyWith(
viewsPath: null == viewsPath
Expand Down Expand Up @@ -245,14 +257,19 @@ class _$ConfigCopyWithImpl<$Res, $Val extends Config>
? _value.preferWeb
: preferWeb // ignore: cast_nullable_to_non_nullable
as bool,
offlineMode: null == offlineMode
? _value.offlineMode
: offlineMode // ignore: cast_nullable_to_non_nullable
as bool,
) as $Val);
}
}

/// @nodoc
abstract class _$$_ConfigCopyWith<$Res> implements $ConfigCopyWith<$Res> {
factory _$$_ConfigCopyWith(_$_Config value, $Res Function(_$_Config) then) =
__$$_ConfigCopyWithImpl<$Res>;
abstract class _$$ConfigImplCopyWith<$Res> implements $ConfigCopyWith<$Res> {
factory _$$ConfigImplCopyWith(
_$ConfigImpl value, $Res Function(_$ConfigImpl) then) =
__$$ConfigImplCopyWithImpl<$Res>;
@override
@useResult
$Res call(
Expand All @@ -276,16 +293,20 @@ abstract class _$$_ConfigCopyWith<$Res> implements $ConfigCopyWith<$Res> {
@JsonKey(name: 'register_mocks_function') String registerMocksFunction,
@JsonKey(name: 'v1') bool v1,
@JsonKey(name: 'line_length') int lineLength,
@JsonKey(name: 'prefer_web') bool preferWeb});
@JsonKey(name: 'prefer_web') bool preferWeb,
@JsonKey(name: 'offline_mode') bool offlineMode});
}

/// @nodoc
class __$$_ConfigCopyWithImpl<$Res>
extends _$ConfigCopyWithImpl<$Res, _$_Config>
implements _$$_ConfigCopyWith<$Res> {
__$$_ConfigCopyWithImpl(_$_Config _value, $Res Function(_$_Config) _then)
class __$$ConfigImplCopyWithImpl<$Res>
extends _$ConfigCopyWithImpl<$Res, _$ConfigImpl>
implements _$$ConfigImplCopyWith<$Res> {
__$$ConfigImplCopyWithImpl(
_$ConfigImpl _value, $Res Function(_$ConfigImpl) _then)
: super(_value, _then);

/// Create a copy of Config
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Expand All @@ -308,8 +329,9 @@ class __$$_ConfigCopyWithImpl<$Res>
Object? v1 = null,
Object? lineLength = null,
Object? preferWeb = null,
Object? offlineMode = null,
}) {
return _then(_$_Config(
return _then(_$ConfigImpl(
viewsPath: null == viewsPath
? _value.viewsPath
: viewsPath // ignore: cast_nullable_to_non_nullable
Expand Down Expand Up @@ -386,14 +408,18 @@ class __$$_ConfigCopyWithImpl<$Res>
? _value.preferWeb
: preferWeb // ignore: cast_nullable_to_non_nullable
as bool,
offlineMode: null == offlineMode
? _value.offlineMode
: offlineMode // ignore: cast_nullable_to_non_nullable
as bool,
));
}
}

/// @nodoc
@JsonSerializable()
class _$_Config implements _Config {
_$_Config(
class _$ConfigImpl implements _Config {
_$ConfigImpl(
{@JsonKey(name: 'views_path') this.viewsPath = 'ui/views',
@JsonKey(name: 'services_path') this.servicesPath = 'services',
@JsonKey(name: 'widgets_path') this.widgetsPath = 'ui/widgets/common',
Expand Down Expand Up @@ -421,10 +447,11 @@ class _$_Config implements _Config {
this.registerMocksFunction = 'registerServices',
@JsonKey(name: 'v1') this.v1 = false,
@JsonKey(name: 'line_length') this.lineLength = 80,
@JsonKey(name: 'prefer_web') this.preferWeb = false});
@JsonKey(name: 'prefer_web') this.preferWeb = false,
@JsonKey(name: 'offline_mode') this.offlineMode = false});

factory _$_Config.fromJson(Map<String, dynamic> json) =>
_$$_ConfigFromJson(json);
factory _$ConfigImpl.fromJson(Map<String, dynamic> json) =>
_$$ConfigImplFromJson(json);

/// Path where views and viewmodels will be genereated.
@override
Expand Down Expand Up @@ -526,16 +553,21 @@ class _$_Config implements _Config {
@JsonKey(name: 'prefer_web')
final bool preferWeb;

/// Boolean value determining if build_runner should run pub get.
@override
@JsonKey(name: 'offline_mode')
final bool offlineMode;

@override
String toString() {
return 'Config(viewsPath: $viewsPath, servicesPath: $servicesPath, widgetsPath: $widgetsPath, bottomSheetsPath: $bottomSheetsPath, bottomSheetTypeFilePath: $bottomSheetTypeFilePath, bottomSheetBuilderFilePath: $bottomSheetBuilderFilePath, dialogsPath: $dialogsPath, dialogTypeFilePath: $dialogTypeFilePath, dialogBuilderFilePath: $dialogBuilderFilePath, stackedAppFilePath: $stackedAppFilePath, testHelpersFilePath: $testHelpersFilePath, testServicesPath: $testServicesPath, testViewsPath: $testViewsPath, testWidgetsPath: $testWidgetsPath, locatorName: $locatorName, registerMocksFunction: $registerMocksFunction, v1: $v1, lineLength: $lineLength, preferWeb: $preferWeb)';
return 'Config(viewsPath: $viewsPath, servicesPath: $servicesPath, widgetsPath: $widgetsPath, bottomSheetsPath: $bottomSheetsPath, bottomSheetTypeFilePath: $bottomSheetTypeFilePath, bottomSheetBuilderFilePath: $bottomSheetBuilderFilePath, dialogsPath: $dialogsPath, dialogTypeFilePath: $dialogTypeFilePath, dialogBuilderFilePath: $dialogBuilderFilePath, stackedAppFilePath: $stackedAppFilePath, testHelpersFilePath: $testHelpersFilePath, testServicesPath: $testServicesPath, testViewsPath: $testViewsPath, testWidgetsPath: $testWidgetsPath, locatorName: $locatorName, registerMocksFunction: $registerMocksFunction, v1: $v1, lineLength: $lineLength, preferWeb: $preferWeb, offlineMode: $offlineMode)';
}

@override
bool operator ==(dynamic other) {
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$_Config &&
other is _$ConfigImpl &&
(identical(other.viewsPath, viewsPath) ||
other.viewsPath == viewsPath) &&
(identical(other.servicesPath, servicesPath) ||
Expand Down Expand Up @@ -575,10 +607,12 @@ class _$_Config implements _Config {
(identical(other.lineLength, lineLength) ||
other.lineLength == lineLength) &&
(identical(other.preferWeb, preferWeb) ||
other.preferWeb == preferWeb));
other.preferWeb == preferWeb) &&
(identical(other.offlineMode, offlineMode) ||
other.offlineMode == offlineMode));
}

@JsonKey(ignore: true)
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hashAll([
runtimeType,
Expand All @@ -600,18 +634,21 @@ class _$_Config implements _Config {
registerMocksFunction,
v1,
lineLength,
preferWeb
preferWeb,
offlineMode
]);

@JsonKey(ignore: true)
/// Create a copy of Config
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$_ConfigCopyWith<_$_Config> get copyWith =>
__$$_ConfigCopyWithImpl<_$_Config>(this, _$identity);
_$$ConfigImplCopyWith<_$ConfigImpl> get copyWith =>
__$$ConfigImplCopyWithImpl<_$ConfigImpl>(this, _$identity);

@override
Map<String, dynamic> toJson() {
return _$$_ConfigToJson(
return _$$ConfigImplToJson(
this,
);
}
Expand Down Expand Up @@ -641,112 +678,120 @@ abstract class _Config implements Config {
final String registerMocksFunction,
@JsonKey(name: 'v1') final bool v1,
@JsonKey(name: 'line_length') final int lineLength,
@JsonKey(name: 'prefer_web') final bool preferWeb}) = _$_Config;
@JsonKey(name: 'prefer_web') final bool preferWeb,
@JsonKey(name: 'offline_mode') final bool offlineMode}) = _$ConfigImpl;

factory _Config.fromJson(Map<String, dynamic> json) = _$_Config.fromJson;

@override
factory _Config.fromJson(Map<String, dynamic> json) = _$ConfigImpl.fromJson;

/// Path where views and viewmodels will be genereated.
@override
@JsonKey(name: 'views_path')
String get viewsPath;
@override

/// Path where services will be genereated.
@override
@JsonKey(name: 'services_path')
String get servicesPath;
@override

/// Path where widgets will be genereated.
@override
@JsonKey(name: 'widgets_path')
String get widgetsPath;
@override

/// Path where bottom sheets will be genereated.
@override
@JsonKey(name: 'bottom_sheets_path')
String get bottomSheetsPath;
@override

/// File path where BottomSheetType enum values are located.
@override
@JsonKey(name: 'bottom_sheet_type_file_path')
String get bottomSheetTypeFilePath;
@override

/// File path where BottomSheet builders are located.
@override
@JsonKey(name: 'bottom_sheet_builder_file_path')
String get bottomSheetBuilderFilePath;
@override

/// Path where dialogs will be genereated.
@override
@JsonKey(name: 'dialogs_path')
String get dialogsPath;
@override

/// File path where DialogType enum values are located.
@override
@JsonKey(name: 'dialog_type_file_path')
String get dialogTypeFilePath;
@override

/// File path where Dialog builders are located.
@override
@JsonKey(name: 'dialog_builder_file_path')
String get dialogBuilderFilePath;
@override

/// File path where StackedApp is setup.
@override
@JsonKey(name: 'stacked_app_file_path')
String get stackedAppFilePath;
@override

/// File path where register functions for unit test setup and mock
/// declarations are located.
@override
@JsonKey(name: 'test_helpers_file_path')
String get testHelpersFilePath;
@override

/// Paths where services unit tests will be genereated.
@override
@JsonKey(name: 'test_services_path')
String get testServicesPath;
@override

/// Path where viewmodels unit tests will be genereated.
@override
@JsonKey(name: 'test_views_path')
String get testViewsPath;
@override

/// Path where widget models unit tests will be genereated.
@override
@JsonKey(name: 'test_widgets_path')
String get testWidgetsPath;
@override

/// The name of the locator to use when registering test mocks
@override
@JsonKey(name: 'locator_name')
String get locatorName;
@override

/// The name of the function that registers the mock services for tests.
///
/// This is used when creating a test file during the `create service` command
@override
@JsonKey(name: 'register_mocks_function')
String get registerMocksFunction;
@override

/// Boolean value to determine view builder style
///
/// This is used when creating a view file during `create view` command. By
/// default, StackedView is used.
@override
@JsonKey(name: 'v1')
bool get v1;
@override

/// Defines the integer value to determine the line length when formatting
/// the code.
@override
@JsonKey(name: 'line_length')
int get lineLength;
@override
@JsonKey(name: 'prefer_web')
bool get preferWeb;

/// Boolean value determining if build_runner should run pub get.
@override
@JsonKey(name: 'offline_mode')
bool get offlineMode;

/// Create a copy of Config
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(ignore: true)
_$$_ConfigCopyWith<_$_Config> get copyWith =>
@JsonKey(includeFromJson: false, includeToJson: false)
_$$ConfigImplCopyWith<_$ConfigImpl> get copyWith =>
throw _privateConstructorUsedError;
}
Loading
Loading