Some linting_tool updates and cleanup (#1279)

pull/1280/head
Parker Lougheed 2 years ago committed by GitHub
parent 50863c5b63
commit d6296157f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -32,7 +32,6 @@
/build/ /build/
# Web related # Web related
lib/generated_plugin_registrant.dart
# Symbolication related # Symbolication related
app.*.symbols app.*.symbols

@ -12,12 +12,10 @@ bool isDisplayLarge(BuildContext context) =>
/// Returns boolean value whether the window is considered medium size. /// Returns boolean value whether the window is considered medium size.
/// Used to build adaptive and responsive layouts. /// Used to build adaptive and responsive layouts.
bool isDisplayMedium(BuildContext context) { bool isDisplayMedium(BuildContext context) =>
return getWindowType(context) == AdaptiveWindowType.medium; getWindowType(context) == AdaptiveWindowType.medium;
}
/// Returns boolean value whether the window is considered small size. /// Returns boolean value whether the window is considered small size.
/// Used to build adaptive and responsive layouts. /// Used to build adaptive and responsive layouts.
bool isDisplaySmall(BuildContext context) { bool isDisplaySmall(BuildContext context) =>
return getWindowType(context) <= AdaptiveWindowType.small; getWindowType(context) <= AdaptiveWindowType.small;
}

@ -10,7 +10,7 @@ import 'package:linting_tool/model/rule.dart';
import 'package:window_size/window_size.dart'; import 'package:window_size/window_size.dart';
Future<void> main() async { Future<void> main() async {
/// Initiliaze Hive DB. /// Initialize Hive DB.
await Hive.initFlutter(); await Hive.initFlutter();
/// Register adapters for [Rule] and [RulesProfile] /// Register adapters for [Rule] and [RulesProfile]

@ -11,7 +11,7 @@ import 'package:linting_tool/model/rule.dart';
class EditingController extends ChangeNotifier { class EditingController extends ChangeNotifier {
bool _isEditing; bool _isEditing;
EditingController({bool? isEditing}) : _isEditing = isEditing ?? false; EditingController({bool isEditing = false}) : _isEditing = isEditing;
bool get isEditing => _isEditing; bool get isEditing => _isEditing;
@ -21,9 +21,9 @@ class EditingController extends ChangeNotifier {
notifyListeners(); notifyListeners();
} }
final List<Rule> _selectedRules = []; final Set<Rule> _selectedRules = {};
List<Rule> get selectedRules => _selectedRules; Set<Rule> get selectedRules => _selectedRules;
void selectRule(Rule rule) { void selectRule(Rule rule) {
_selectedRules.add(rule); _selectedRules.add(rule);
@ -37,12 +37,10 @@ class EditingController extends ChangeNotifier {
Future deleteSelected( Future deleteSelected(
RulesProfile profile, ProfilesStore profilesStore) async { RulesProfile profile, ProfilesStore profilesStore) async {
var rules = profile.rules; final rules = profile.rules;
for (var rule in _selectedRules) { rules.removeWhere((rule) => _selectedRules.contains(rule));
rules.remove(rule);
}
RulesProfile newProfile = RulesProfile(name: profile.name, rules: rules); final newProfile = RulesProfile(name: profile.name, rules: rules);
await profilesStore.updateProfile(profile, newProfile); await profilesStore.updateProfile(profile, newProfile);

@ -20,11 +20,12 @@ import 'package:yaml/yaml.dart';
const _boxName = 'rules_profile'; const _boxName = 'rules_profile';
class ProfilesStore extends ChangeNotifier { class ProfilesStore extends ChangeNotifier {
late final Repository repository; final Repository repository;
ProfilesStore(http.Client httpClient) {
repository = Repository(httpClient); ProfilesStore(http.Client httpClient) : repository = Repository(httpClient) {
fetchSavedProfiles(); fetchSavedProfiles();
} }
bool _isLoading = true; bool _isLoading = true;
bool get isLoading => _isLoading; bool get isLoading => _isLoading;
@ -41,8 +42,7 @@ class ProfilesStore extends ChangeNotifier {
if (!_isLoading) _isLoading = true; if (!_isLoading) _isLoading = true;
notifyListeners(); notifyListeners();
try { try {
var profiles = await HiveService.getBoxes<RulesProfile>(_boxName); _savedProfiles = await HiveService.getBoxes<RulesProfile>(_boxName);
_savedProfiles = profiles;
} on Exception catch (e) { } on Exception catch (e) {
log(e.toString()); log(e.toString());
} }
@ -64,12 +64,16 @@ class ProfilesStore extends ChangeNotifier {
// TODO(abd99): Consider refactoring to LinkedHashSet/SplayTreeSet to avoid // TODO(abd99): Consider refactoring to LinkedHashSet/SplayTreeSet to avoid
// duplication automatically. // duplication automatically.
// ref: https://github.com/flutter/samples/pull/870#discussion_r685666792 // ref: https://github.com/flutter/samples/pull/870#discussion_r685666792
var rules = profile.rules; final rules = profile.rules;
if (!rules.contains(rule)) {
rules.add(rule); // If rule is already in profile, skip updating profile
if (rules.contains(rule)) {
return;
} }
RulesProfile newProfile = RulesProfile(name: profile.name, rules: rules); rules.add(rule);
final newProfile = RulesProfile(name: profile.name, rules: rules);
await HiveService.updateBox<RulesProfile>(profile, newProfile, _boxName); await HiveService.updateBox<RulesProfile>(profile, newProfile, _boxName);
@ -88,7 +92,7 @@ class ProfilesStore extends ChangeNotifier {
} }
Future<void> removeRuleFromProfile(RulesProfile profile, Rule rule) async { Future<void> removeRuleFromProfile(RulesProfile profile, Rule rule) async {
var newProfile = final newProfile =
RulesProfile(name: profile.name, rules: profile.rules..remove(rule)); RulesProfile(name: profile.name, rules: profile.rules..remove(rule));
await updateProfile(profile, newProfile); await updateProfile(profile, newProfile);
} }
@ -111,10 +115,10 @@ class ProfilesStore extends ChangeNotifier {
var resultSaved = false; var resultSaved = false;
try { try {
var templateFileData = await repository.getTemplateFile(); final templateFileData = await repository.getTemplateFile();
/// Fetch formatted data to create new YamlFile. /// Fetch formatted data to create new YamlFile.
String newYamlFile = final newYamlFile =
_prepareYamlFile(profile, templateFileData, rulesStyle); _prepareYamlFile(profile, templateFileData, rulesStyle);
resultSaved = await _saveFileToDisk(newYamlFile); resultSaved = await _saveFileToDisk(newYamlFile);
@ -136,7 +140,7 @@ class ProfilesStore extends ChangeNotifier {
const name = 'analysis_options.yaml'; const name = 'analysis_options.yaml';
/// Get file path using file picker. /// Get file path using file picker.
var savePath = await file_selector.getSavePath( final savePath = await file_selector.getSavePath(
suggestedName: name, suggestedName: name,
); );
@ -149,25 +153,21 @@ class ProfilesStore extends ChangeNotifier {
return true; return true;
} }
var errorMessage = 'File path not found.'; const errorMessage = 'File path not found.';
_error = errorMessage; _error = errorMessage;
throw Exception(errorMessage); throw Exception(errorMessage);
} }
String _prepareYamlFile( String _prepareYamlFile(
RulesProfile profile, YamlMap templateFile, RulesStyle rulesStyle) { RulesProfile profile, YamlMap templateFile, RulesStyle rulesStyle) {
var rules = profile.rules.map((e) => e.name).toList(); final rules = profile.rules.map((e) => e.name);
var rulesData = final rulesData =
json.decode(json.encode(templateFile)) as Map<String, dynamic>; json.decode(json.encode(templateFile)) as Map<String, dynamic>;
/// Add rules to existing template according to formatting style. /// Add rules to existing template according to formatting style.
if (rulesStyle == RulesStyle.booleanMap) { if (rulesStyle == RulesStyle.booleanMap) {
var rulesMap = Map.fromEntries( final rulesMap = <String, bool>{for (final rule in rules) rule: true};
rules.map(
(e) => MapEntry(e, true),
),
);
rulesData.update('linter', (dynamic value) => {'rules': rulesMap}); rulesData.update('linter', (dynamic value) => {'rules': rulesMap});
} else { } else {
rulesData.update('linter', (dynamic value) => {'rules': rules}); rulesData.update('linter', (dynamic value) => {'rules': rules});

@ -41,5 +41,5 @@ class Rule extends Equatable {
Map<String, dynamic> toJson() => _$RuleToJson(this); Map<String, dynamic> toJson() => _$RuleToJson(this);
@override @override
List<Object?> get props => [name]; List<Object> get props => [name];
} }

@ -62,19 +62,17 @@ class RuleAdapter extends TypeAdapter<Rule> {
// JsonSerializableGenerator // JsonSerializableGenerator
// ************************************************************************** // **************************************************************************
Rule _$RuleFromJson(Map<String, dynamic> json) { Rule _$RuleFromJson(Map<String, dynamic> json) => Rule(
return Rule( name: json['name'] as String,
name: json['name'] as String, description: json['description'] as String,
description: json['description'] as String, group: json['group'] as String,
group: json['group'] as String, maturity: json['maturity'] as String,
maturity: json['maturity'] as String, incompatible: (json['incompatible'] as List<dynamic>)
incompatible: (json['incompatible'] as List<dynamic>) .map((e) => e as String)
.map((e) => e as String) .toList(),
.toList(), sets: (json['sets'] as List<dynamic>).map((e) => e as String).toList(),
sets: (json['sets'] as List<dynamic>).map((e) => e as String).toList(), details: json['details'] as String,
details: json['details'] as String, );
);
}
Map<String, dynamic> _$RuleToJson(Rule instance) => <String, dynamic>{ Map<String, dynamic> _$RuleToJson(Rule instance) => <String, dynamic>{
'name': instance.name, 'name': instance.name,

@ -13,12 +13,12 @@ import 'package:linting_tool/repository/repository.dart';
/// Manages fetching rules from the web. /// Manages fetching rules from the web.
class RuleStore extends ChangeNotifier { class RuleStore extends ChangeNotifier {
late final Repository repository; final Repository repository;
RuleStore(http.Client httpClient) { RuleStore(http.Client httpClient) : repository = Repository(httpClient) {
repository = Repository(httpClient);
fetchRules(); fetchRules();
} }
bool _isLoading = true; bool _isLoading = true;
bool get isLoading => _isLoading; bool get isLoading => _isLoading;
@ -32,32 +32,31 @@ class RuleStore extends ChangeNotifier {
String? get error => _error; String? get error => _error;
List<RulesProfile> get defaultProfiles { List<RulesProfile> get defaultProfiles {
List<RulesProfile> defaultProfiles = []; if (isLoading || rules.isEmpty) {
return const [];
}
var rulesWithDefaultSets = final Map<String, RulesProfile> setsToProfiles = {};
rules.where((rule) => rule.sets.isNotEmpty).toList();
for (final rule in rulesWithDefaultSets) { for (final rule in rules) {
for (final setName in rule.sets) { for (final setName in rule.sets) {
var profileIndex = final profile = setsToProfiles[setName];
defaultProfiles.indexWhere((profile) => profile.name == setName); if (profile == null) {
if (profileIndex >= 0) { setsToProfiles[setName] = RulesProfile(name: setName, rules: [rule]);
defaultProfiles[profileIndex].rules.add(rule);
} else { } else {
defaultProfiles.add(RulesProfile(name: setName, rules: [rule])); profile.rules.add(rule);
} }
} }
} }
return defaultProfiles; return setsToProfiles.values.toList(growable: false);
} }
Future<void> fetchRules() async { Future<void> fetchRules() async {
if (!_isLoading) _isLoading = true; if (!_isLoading) _isLoading = true;
notifyListeners(); notifyListeners();
try { try {
var rules = await repository.getRulesList(); _rules = await repository.getRulesList();
_rules = rules;
} on SocketException catch (e) { } on SocketException catch (e) {
log(e.toString()); log(e.toString());
_error = 'Check internet connection.'; _error = 'Check internet connection.';

@ -20,8 +20,8 @@ class DefaultLintsPage extends StatelessWidget {
return const CircularProgressIndicator.adaptive(); return const CircularProgressIndicator.adaptive();
} }
if (rulesStore.defaultProfiles.isNotEmpty) { final defaultSets = rulesStore.defaultProfiles;
var defaultSets = rulesStore.defaultProfiles; if (defaultSets.isNotEmpty) {
final isDesktop = isDisplayLarge(context); final isDesktop = isDisplayLarge(context);
final isTablet = isDisplayMedium(context); final isTablet = isDisplayMedium(context);
final startPadding = isTablet final startPadding = isTablet
@ -45,7 +45,7 @@ class DefaultLintsPage extends StatelessWidget {
cacheExtent: 5, cacheExtent: 5,
itemCount: defaultSets.length, itemCount: defaultSets.length,
itemBuilder: (context, index) { itemBuilder: (context, index) {
var profile = rulesStore.defaultProfiles[index]; final profile = defaultSets[index];
return ListTile( return ListTile(
title: Text( title: Text(
profile.name, profile.name,

@ -20,7 +20,7 @@ class DefaultRulesPage extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
final isDesktop = isDisplayLarge(context); final isDesktop = isDisplayLarge(context);
final isTablet = isDisplayMedium(context); final isTablet = isDisplayMedium(context);
var textTheme = Theme.of(context).textTheme; final textTheme = Theme.of(context).textTheme;
final startPadding = isTablet final startPadding = isTablet
? 60.0 ? 60.0
: isDesktop : isDesktop

@ -19,38 +19,36 @@ class HomePage extends StatelessWidget {
return const CircularProgressIndicator.adaptive(); return const CircularProgressIndicator.adaptive();
} }
if (!rulesStore.isLoading) { if (rulesStore.rules.isNotEmpty) {
if (rulesStore.rules.isNotEmpty) { final isDesktop = isDisplayLarge(context);
final isDesktop = isDisplayLarge(context); final isTablet = isDisplayMedium(context);
final isTablet = isDisplayMedium(context); final startPadding = isTablet
final startPadding = isTablet ? 60.0
? 60.0 : isDesktop
: isDesktop ? 120.0
? 120.0 : 16.0;
: 16.0; final endPadding = isTablet
final endPadding = isTablet ? 60.0
? 60.0 : isDesktop
: isDesktop ? 120.0
? 120.0 : 16.0;
: 16.0;
return ListView.separated( return ListView.separated(
padding: EdgeInsetsDirectional.only( padding: EdgeInsetsDirectional.only(
start: startPadding, start: startPadding,
end: endPadding, end: endPadding,
top: isDesktop ? 28 : 16, top: isDesktop ? 28 : 16,
bottom: isDesktop ? kToolbarHeight : 16, bottom: isDesktop ? kToolbarHeight : 16,
), ),
itemCount: rulesStore.rules.length, itemCount: rulesStore.rules.length,
cacheExtent: 5, cacheExtent: 5,
itemBuilder: (context, index) { itemBuilder: (context, index) {
return LintExpansionTile( return LintExpansionTile(
rule: rulesStore.rules[index], rule: rulesStore.rules[index],
); );
}, },
separatorBuilder: (context, index) => const SizedBox(height: 4), separatorBuilder: (context, index) => const SizedBox(height: 4),
); );
}
} }
return Column( return Column(

@ -23,7 +23,7 @@ class RulesPage extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
final isDesktop = isDisplayLarge(context); final isDesktop = isDisplayLarge(context);
final isTablet = isDisplayMedium(context); final isTablet = isDisplayMedium(context);
var textTheme = Theme.of(context).textTheme; final textTheme = Theme.of(context).textTheme;
final startPadding = isTablet final startPadding = isTablet
? 60.0 ? 60.0
: isDesktop : isDesktop
@ -85,7 +85,7 @@ class RulesPage extends StatelessWidget {
itemCount: profile.rules.length, itemCount: profile.rules.length,
cacheExtent: 5, cacheExtent: 5,
itemBuilder: (context, index) { itemBuilder: (context, index) {
/// Show righ-click context menu to delete rule. /// Show right-click context menu to delete rule.
return ContextMenuRegion( return ContextMenuRegion(
contextMenu: GenericContextMenu( contextMenu: GenericContextMenu(
buttonConfigs: [ buttonConfigs: [

@ -8,8 +8,10 @@ import 'package:linting_tool/model/rule.dart';
import 'package:yaml/yaml.dart'; import 'package:yaml/yaml.dart';
class APIProvider { class APIProvider {
final _baseURL = 'https://dart-lang.github.io/linter'; static const String _baseURL = 'https://dart-lang.github.io/linter';
final http.Client httpClient; final http.Client httpClient;
APIProvider(this.httpClient); APIProvider(this.httpClient);
Future<List<Rule>> getRulesList() async { Future<List<Rule>> getRulesList() async {
@ -17,11 +19,10 @@ class APIProvider {
await httpClient.get(Uri.parse('$_baseURL//lints/machine/rules.json')); await httpClient.get(Uri.parse('$_baseURL//lints/machine/rules.json'));
if (response.statusCode == 200) { if (response.statusCode == 200) {
List<Rule> rulesList = [];
final data = json.decode(response.body) as List; final data = json.decode(response.body) as List;
for (var item in data) { final rulesList = [
rulesList.add(Rule.fromJson(item as Map<String, dynamic>)); for (final item in data) Rule.fromJson(item as Map<String, dynamic>)
} ];
return rulesList; return rulesList;
} else { } else {
throw Exception('Failed to load rules'); throw Exception('Failed to load rules');

@ -10,7 +10,7 @@ class HiveService {
boxName, boxName,
); );
List<T> existingProducts = await getBoxes(boxName); final List<T> existingProducts = await getBoxes(boxName);
if (!existingProducts.contains(item)) { if (!existingProducts.contains(item)) {
await openBox.add(item); await openBox.add(item);
@ -24,9 +24,9 @@ class HiveService {
boxName, boxName,
); );
List<T> existingProducts = await getBoxes(boxName); final Set<T> existingProducts = Set.unmodifiable(await getBoxes(boxName));
for (var item in items) { for (final item in items) {
if (!existingProducts.contains(item)) { if (!existingProducts.contains(item)) {
await openBox.add(item); await openBox.add(item);
} }
@ -38,9 +38,9 @@ class HiveService {
boxName, boxName,
); );
List<T> boxes = await getBoxes(boxName); final List<T> boxes = await getBoxes(boxName);
for (var box in boxes) { for (final box in boxes) {
if (box == item) { if (box == item) {
await openBox.deleteAt(boxes.indexOf(item)); await openBox.deleteAt(boxes.indexOf(item));
} }
@ -52,9 +52,9 @@ class HiveService {
boxName, boxName,
); );
List<T> boxes = await getBoxes(boxName); final List<T> boxes = await getBoxes(boxName);
for (var box in boxes) { for (final box in boxes) {
if (box == item) { if (box == item) {
await openBox.putAt(boxes.indexOf(item), newItem); await openBox.putAt(boxes.indexOf(item), newItem);
} }
@ -62,15 +62,13 @@ class HiveService {
} }
static Future<List<T>> getBoxes<T>(String boxName, [String? query]) async { static Future<List<T>> getBoxes<T>(String boxName, [String? query]) async {
List<T> boxList = [];
final openBox = await Hive.openLazyBox<T>(boxName); final openBox = await Hive.openLazyBox<T>(boxName);
int length = openBox.length; final length = openBox.length;
for (int i = 0; i < length; i++) { final boxList = <T>[
boxList.add(await openBox.getAt(i) as T); for (int i = 0; i < length; i++) await openBox.getAt(i) as T
} ];
return boxList; return boxList;
} }

@ -8,11 +8,9 @@ import 'package:linting_tool/repository/api_provider.dart';
import 'package:yaml/yaml.dart'; import 'package:yaml/yaml.dart';
class Repository { class Repository {
late final APIProvider _apiProvider; final APIProvider _apiProvider;
Repository(http.Client httpClient) { Repository(http.Client httpClient) : _apiProvider = APIProvider(httpClient);
_apiProvider = APIProvider(httpClient);
}
Future<List<Rule>> getRulesList() => _apiProvider.getRulesList(); Future<List<Rule>> getRulesList() => _apiProvider.getRulesList();

@ -7,7 +7,7 @@ import 'package:flutter_markdown/flutter_markdown.dart';
import 'package:google_fonts/google_fonts.dart'; import 'package:google_fonts/google_fonts.dart';
import 'package:linting_tool/theme/colors.dart'; import 'package:linting_tool/theme/colors.dart';
class AppTheme { abstract class AppTheme {
static ThemeData buildReplyLightTheme(BuildContext context) { static ThemeData buildReplyLightTheme(BuildContext context) {
final base = ThemeData.light(); final base = ThemeData.light();
return base.copyWith( return base.copyWith(

@ -4,7 +4,7 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
class AppColors { abstract class AppColors {
static const Color white50 = Color(0xFFFFFFFF); static const Color white50 = Color(0xFFFFFFFF);
static const Color black800 = Color(0xFF121212); static const Color black800 = Color(0xFF121212);

@ -46,7 +46,7 @@ class _AdaptiveNavState extends State<AdaptiveNav> {
), ),
]; ];
final trailing = <String, IconData>{ const trailing = <String, IconData>{
'About': Icons.info_outline, 'About': Icons.info_outline,
}; };
@ -62,25 +62,25 @@ class _NavView extends StatefulWidget {
const _NavView({ const _NavView({
required this.extended, required this.extended,
required this.destinations, required this.destinations,
this.trailing, this.trailing = const {},
}); });
final bool extended; final bool extended;
final List<_Destination> destinations; final List<_Destination> destinations;
final Map<String, IconData>? trailing; final Map<String, IconData> trailing;
@override @override
_NavViewState createState() => _NavViewState(); _NavViewState createState() => _NavViewState();
} }
class _NavViewState extends State<_NavView> { class _NavViewState extends State<_NavView> {
late ValueNotifier<bool?> _isExtended; late final ValueNotifier<bool> _isExtended;
var _selectedIndex = 0; var _selectedIndex = 0;
@override @override
void initState() { void initState() {
super.initState(); super.initState();
_isExtended = ValueNotifier<bool?>(widget.extended); _isExtended = ValueNotifier<bool>(widget.extended);
} }
void _onDestinationSelected(int index) { void _onDestinationSelected(int index) {
@ -91,7 +91,7 @@ class _NavViewState extends State<_NavView> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
var textTheme = Theme.of(context).textTheme; final textTheme = Theme.of(context).textTheme;
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: Text( title: Text(
@ -115,7 +115,7 @@ class _NavViewState extends State<_NavView> {
minHeight: constraints.maxHeight, minHeight: constraints.maxHeight,
), ),
child: IntrinsicHeight( child: IntrinsicHeight(
child: ValueListenableBuilder<bool?>( child: ValueListenableBuilder<bool>(
valueListenable: _isExtended, valueListenable: _isExtended,
builder: (context, value, child) { builder: (context, value, child) {
var isSmallDisplay = isDisplaySmall(context); var isSmallDisplay = isDisplaySmall(context);
@ -130,13 +130,13 @@ class _NavViewState extends State<_NavView> {
label: Text(destination.textLabel), label: Text(destination.textLabel),
), ),
], ],
extended: _isExtended.value! && !isSmallDisplay, extended: _isExtended.value && !isSmallDisplay,
labelType: NavigationRailLabelType.none, labelType: NavigationRailLabelType.none,
leading: _NavigationRailHeader( leading: _NavigationRailHeader(
extended: _isExtended, extended: _isExtended,
), ),
trailing: _NavigationRailTrailingSection( trailing: _NavigationRailTrailingSection(
trailingDestinations: widget.trailing!, trailingDestinations: widget.trailing,
), ),
selectedIndex: _selectedIndex, selectedIndex: _selectedIndex,
onDestinationSelected: _onDestinationSelected, onDestinationSelected: _onDestinationSelected,

@ -13,6 +13,7 @@ import 'package:provider/provider.dart';
class LintExpansionTile extends StatefulWidget { class LintExpansionTile extends StatefulWidget {
final Rule rule; final Rule rule;
const LintExpansionTile({ const LintExpansionTile({
required this.rule, required this.rule,
super.key, super.key,
@ -24,10 +25,11 @@ class LintExpansionTile extends StatefulWidget {
class _LintExpansionTileState extends State<LintExpansionTile> { class _LintExpansionTileState extends State<LintExpansionTile> {
var isExpanded = false; var isExpanded = false;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
var theme = Theme.of(context); final theme = Theme.of(context);
var textTheme = theme.textTheme; final textTheme = theme.textTheme;
final rule = widget.rule; final rule = widget.rule;
final incompatibleString = final incompatibleString =
rule.incompatible.isNotEmpty ? rule.incompatible.join(', ') : 'none'; rule.incompatible.isNotEmpty ? rule.incompatible.join(', ') : 'none';
@ -287,8 +289,8 @@ class ExistingProfileDialog extends StatefulWidget {
class _ExistingProfileDialogState extends State<ExistingProfileDialog> { class _ExistingProfileDialogState extends State<ExistingProfileDialog> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
var profilesStore = Provider.of<ProfilesStore>(context); final profilesStore = Provider.of<ProfilesStore>(context);
var savedProfiles = profilesStore.savedProfiles; final savedProfiles = profilesStore.savedProfiles;
return AlertDialog( return AlertDialog(
title: const Text('Select a lint profile'), title: const Text('Select a lint profile'),
content: Column( content: Column(

@ -12,6 +12,7 @@ import 'package:provider/provider.dart';
class SavedRuleTile extends StatefulWidget { class SavedRuleTile extends StatefulWidget {
final Rule rule; final Rule rule;
const SavedRuleTile({ const SavedRuleTile({
required this.rule, required this.rule,
super.key, super.key,
@ -27,8 +28,8 @@ class _SavedRuleTileState extends State<SavedRuleTile> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
var theme = Theme.of(context); final theme = Theme.of(context);
var textTheme = theme.textTheme; final textTheme = theme.textTheme;
final rule = widget.rule; final rule = widget.rule;
final incompatibleString = final incompatibleString =
rule.incompatible.isNotEmpty ? rule.incompatible.join(', ') : 'none'; rule.incompatible.isNotEmpty ? rule.incompatible.join(', ') : 'none';

@ -31,7 +31,7 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS: SPEC CHECKSUMS:
file_selector_macos: f1b08a781e66103e3ba279fd5d4024a2478b3af6 file_selector_macos: f1b08a781e66103e3ba279fd5d4024a2478b3af6
FlutterMacOS: 57701585bf7de1b3fc2bb61f6378d73bbdea8424 FlutterMacOS: 57701585bf7de1b3fc2bb61f6378d73bbdea8424
path_provider_macos: 160cab0d5461f0c0e02995469a98f24bdb9a3f1f path_provider_macos: 3c0c3b4b0d4a76d2bf989a913c2de869c5641a19
url_launcher_macos: 597e05b8e514239626bcf4a850fcf9ef5c856ec3 url_launcher_macos: 597e05b8e514239626bcf4a850fcf9ef5c856ec3
window_size: 339dafa0b27a95a62a843042038fa6c3c48de195 window_size: 339dafa0b27a95a62a843042038fa6c3c48de195

@ -7,35 +7,35 @@ packages:
name: _fe_analyzer_shared name: _fe_analyzer_shared
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "38.0.0" version: "40.0.0"
adaptive_breakpoints: adaptive_breakpoints:
dependency: "direct main" dependency: "direct main"
description: description:
name: adaptive_breakpoints name: adaptive_breakpoints
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.1.1" version: "0.1.2"
analyzer: analyzer:
dependency: transitive dependency: transitive
description: description:
name: analyzer name: analyzer
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "3.4.1" version: "4.1.0"
args: args:
dependency: transitive dependency: transitive
description: description:
name: args name: args
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.3.0" version: "2.3.1"
async: async:
dependency: transitive dependency: transitive
description: description:
name: async name: async
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.8.2" version: "2.9.0"
boolean_selector: boolean_selector:
dependency: transitive dependency: transitive
description: description:
@ -77,7 +77,7 @@ packages:
name: build_runner name: build_runner
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.10" version: "2.1.11"
build_runner_core: build_runner_core:
dependency: transitive dependency: transitive
description: description:
@ -105,7 +105,7 @@ packages:
name: characters name: characters
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.2.0" version: "1.2.1"
charcode: charcode:
dependency: transitive dependency: transitive
description: description:
@ -203,7 +203,7 @@ packages:
name: ffi name: ffi
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.1.2" version: "1.2.1"
file: file:
dependency: transitive dependency: transitive
description: description:
@ -217,7 +217,7 @@ packages:
name: file_selector name: file_selector
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.8.4+1" version: "0.8.4+2"
file_selector_linux: file_selector_linux:
dependency: "direct main" dependency: "direct main"
description: description:
@ -231,7 +231,7 @@ packages:
name: file_selector_macos name: file_selector_macos
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.8.2" version: "0.8.2+1"
file_selector_platform_interface: file_selector_platform_interface:
dependency: transitive dependency: transitive
description: description:
@ -245,21 +245,21 @@ packages:
name: file_selector_web name: file_selector_web
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.8.1+3" version: "0.8.1+5"
file_selector_windows: file_selector_windows:
dependency: "direct main" dependency: "direct main"
description: description:
name: file_selector_windows name: file_selector_windows
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.8.2" version: "0.8.2+1"
fixnum: fixnum:
dependency: transitive dependency: transitive
description: description:
name: fixnum name: fixnum
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.0.0" version: "1.0.1"
flutter: flutter:
dependency: "direct main" dependency: "direct main"
description: flutter description: flutter
@ -295,7 +295,7 @@ packages:
name: frontend_server_client name: frontend_server_client
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.2" version: "2.1.3"
glob: glob:
dependency: transitive dependency: transitive
description: description:
@ -309,7 +309,7 @@ packages:
name: google_fonts name: google_fonts
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.3.2" version: "3.0.0"
graphs: graphs:
dependency: transitive dependency: transitive
description: description:
@ -323,7 +323,7 @@ packages:
name: hive name: hive
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.0" version: "2.2.1"
hive_flutter: hive_flutter:
dependency: "direct main" dependency: "direct main"
description: description:
@ -337,7 +337,7 @@ packages:
name: hive_generator name: hive_generator
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.1.2" version: "1.1.3"
http: http:
dependency: "direct main" dependency: "direct main"
description: description:
@ -358,7 +358,7 @@ packages:
name: http_parser name: http_parser
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "4.0.0" version: "4.0.1"
io: io:
dependency: transitive dependency: transitive
description: description:
@ -449,7 +449,7 @@ packages:
name: mockito name: mockito
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "5.1.0" version: "5.2.0"
nested: nested:
dependency: transitive dependency: transitive
description: description:
@ -477,49 +477,49 @@ packages:
name: path_provider name: path_provider
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.9" version: "2.0.10"
path_provider_android: path_provider_android:
dependency: transitive dependency: transitive
description: description:
name: path_provider_android name: path_provider_android
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.13" version: "2.0.14"
path_provider_ios: path_provider_ios:
dependency: transitive dependency: transitive
description: description:
name: path_provider_ios name: path_provider_ios
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.8" version: "2.0.9"
path_provider_linux: path_provider_linux:
dependency: transitive dependency: transitive
description: description:
name: path_provider_linux name: path_provider_linux
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.5" version: "2.1.6"
path_provider_macos: path_provider_macos:
dependency: transitive dependency: transitive
description: description:
name: path_provider_macos name: path_provider_macos
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.5" version: "2.0.6"
path_provider_platform_interface: path_provider_platform_interface:
dependency: transitive dependency: transitive
description: description:
name: path_provider_platform_interface name: path_provider_platform_interface
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.3" version: "2.0.4"
path_provider_windows: path_provider_windows:
dependency: transitive dependency: transitive
description: description:
name: path_provider_windows name: path_provider_windows
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.5" version: "2.0.6"
platform: platform:
dependency: transitive dependency: transitive
description: description:
@ -608,7 +608,7 @@ packages:
name: source_span name: source_span
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.8.2" version: "1.9.0"
stack_trace: stack_trace:
dependency: transitive dependency: transitive
description: description:
@ -636,7 +636,7 @@ packages:
name: string_scanner name: string_scanner
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.1.0" version: "1.1.1"
term_glyph: term_glyph:
dependency: transitive dependency: transitive
description: description:
@ -664,42 +664,42 @@ packages:
name: typed_data name: typed_data
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.3.0" version: "1.3.1"
url_launcher: url_launcher:
dependency: transitive dependency: transitive
description: description:
name: url_launcher name: url_launcher
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "6.1.0" version: "6.1.2"
url_launcher_android: url_launcher_android:
dependency: transitive dependency: transitive
description: description:
name: url_launcher_android name: url_launcher_android
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "6.0.16" version: "6.0.17"
url_launcher_ios: url_launcher_ios:
dependency: transitive dependency: transitive
description: description:
name: url_launcher_ios name: url_launcher_ios
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "6.0.15" version: "6.0.17"
url_launcher_linux: url_launcher_linux:
dependency: transitive dependency: transitive
description: description:
name: url_launcher_linux name: url_launcher_linux
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "3.0.0" version: "3.0.1"
url_launcher_macos: url_launcher_macos:
dependency: transitive dependency: transitive
description: description:
name: url_launcher_macos name: url_launcher_macos
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "3.0.0" version: "3.0.1"
url_launcher_platform_interface: url_launcher_platform_interface:
dependency: transitive dependency: transitive
description: description:
@ -713,14 +713,14 @@ packages:
name: url_launcher_web name: url_launcher_web
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.9" version: "2.0.11"
url_launcher_windows: url_launcher_windows:
dependency: transitive dependency: transitive
description: description:
name: url_launcher_windows name: url_launcher_windows
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "3.0.0" version: "3.0.1"
vector_math: vector_math:
dependency: transitive dependency: transitive
description: description:
@ -748,7 +748,7 @@ packages:
name: win32 name: win32
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.5.2" version: "2.6.1"
window_size: window_size:
dependency: "direct main" dependency: "direct main"
description: description:
@ -771,7 +771,7 @@ packages:
name: yaml name: yaml
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "3.1.0" version: "3.1.1"
sdks: sdks:
dart: ">=2.17.0-206.0.dev <3.0.0" dart: ">=2.17.0 <3.0.0"
flutter: ">=2.10.0" flutter: ">=2.10.0"

@ -20,12 +20,12 @@ dependencies:
file_selector_web: ^0.8.1+1 file_selector_web: ^0.8.1+1
file_selector_windows: ^0.8.2 file_selector_windows: ^0.8.2
flutter_markdown: ^0.6.2 flutter_markdown: ^0.6.2
google_fonts: ^2.1.0 google_fonts: ^3.0.0
hive: ^2.0.4 hive: ^2.0.4
hive_flutter: ^1.1.0 hive_flutter: ^1.1.0
http: ^0.13.3 http: ^0.13.3
json2yaml: ^3.0.0 json2yaml: ^3.0.0
json_annotation: ^4.0.1 json_annotation: ^4.5.0
mockito: ^5.0.13 mockito: ^5.0.13
provider: ^6.0.2 provider: ^6.0.2
yaml: ^3.1.0 yaml: ^3.1.0

@ -1,4 +1,4 @@
// Mocks generated by Mockito 5.0.13 from annotations // Mocks generated by Mockito 5.2.0 from annotations
// in linting_tool/test/widget_test.dart. // in linting_tool/test/widget_test.dart.
// Do not manually edit this file. // Do not manually edit this file.
@ -12,6 +12,7 @@ import 'package:http/src/response.dart' as _i2;
import 'package:http/src/streamed_response.dart' as _i3; import 'package:http/src/streamed_response.dart' as _i3;
import 'package:mockito/mockito.dart' as _i1; import 'package:mockito/mockito.dart' as _i1;
// ignore_for_file: type=lint
// ignore_for_file: avoid_redundant_argument_values // ignore_for_file: avoid_redundant_argument_values
// ignore_for_file: avoid_setters_without_getters // ignore_for_file: avoid_setters_without_getters
// ignore_for_file: comment_references // ignore_for_file: comment_references
@ -19,10 +20,12 @@ import 'package:mockito/mockito.dart' as _i1;
// ignore_for_file: invalid_use_of_visible_for_testing_member // ignore_for_file: invalid_use_of_visible_for_testing_member
// ignore_for_file: prefer_const_constructors // ignore_for_file: prefer_const_constructors
// ignore_for_file: unnecessary_parenthesis // ignore_for_file: unnecessary_parenthesis
// ignore_for_file: camel_case_types
class _FakeResponse extends _i1.Fake implements _i2.Response {} class _FakeResponse_0 extends _i1.Fake implements _i2.Response {}
class _FakeStreamedResponse extends _i1.Fake implements _i3.StreamedResponse {} class _FakeStreamedResponse_1 extends _i1.Fake implements _i3.StreamedResponse {
}
/// A class which mocks [Client]. /// A class which mocks [Client].
/// ///
@ -35,12 +38,12 @@ class MockClient extends _i1.Mock implements _i4.Client {
@override @override
_i5.Future<_i2.Response> head(Uri? url, {Map<String, String>? headers}) => _i5.Future<_i2.Response> head(Uri? url, {Map<String, String>? headers}) =>
(super.noSuchMethod(Invocation.method(#head, [url], {#headers: headers}), (super.noSuchMethod(Invocation.method(#head, [url], {#headers: headers}),
returnValue: Future<_i2.Response>.value(_FakeResponse())) returnValue: Future<_i2.Response>.value(_FakeResponse_0()))
as _i5.Future<_i2.Response>); as _i5.Future<_i2.Response>);
@override @override
_i5.Future<_i2.Response> get(Uri? url, {Map<String, String>? headers}) => _i5.Future<_i2.Response> get(Uri? url, {Map<String, String>? headers}) =>
(super.noSuchMethod(Invocation.method(#get, [url], {#headers: headers}), (super.noSuchMethod(Invocation.method(#get, [url], {#headers: headers}),
returnValue: Future<_i2.Response>.value(_FakeResponse())) returnValue: Future<_i2.Response>.value(_FakeResponse_0()))
as _i5.Future<_i2.Response>); as _i5.Future<_i2.Response>);
@override @override
_i5.Future<_i2.Response> post(Uri? url, _i5.Future<_i2.Response> post(Uri? url,
@ -50,7 +53,7 @@ class MockClient extends _i1.Mock implements _i4.Client {
(super.noSuchMethod( (super.noSuchMethod(
Invocation.method(#post, [url], Invocation.method(#post, [url],
{#headers: headers, #body: body, #encoding: encoding}), {#headers: headers, #body: body, #encoding: encoding}),
returnValue: Future<_i2.Response>.value(_FakeResponse())) returnValue: Future<_i2.Response>.value(_FakeResponse_0()))
as _i5.Future<_i2.Response>); as _i5.Future<_i2.Response>);
@override @override
_i5.Future<_i2.Response> put(Uri? url, _i5.Future<_i2.Response> put(Uri? url,
@ -60,7 +63,7 @@ class MockClient extends _i1.Mock implements _i4.Client {
(super.noSuchMethod( (super.noSuchMethod(
Invocation.method(#put, [url], Invocation.method(#put, [url],
{#headers: headers, #body: body, #encoding: encoding}), {#headers: headers, #body: body, #encoding: encoding}),
returnValue: Future<_i2.Response>.value(_FakeResponse())) returnValue: Future<_i2.Response>.value(_FakeResponse_0()))
as _i5.Future<_i2.Response>); as _i5.Future<_i2.Response>);
@override @override
_i5.Future<_i2.Response> patch(Uri? url, _i5.Future<_i2.Response> patch(Uri? url,
@ -70,7 +73,7 @@ class MockClient extends _i1.Mock implements _i4.Client {
(super.noSuchMethod( (super.noSuchMethod(
Invocation.method(#patch, [url], Invocation.method(#patch, [url],
{#headers: headers, #body: body, #encoding: encoding}), {#headers: headers, #body: body, #encoding: encoding}),
returnValue: Future<_i2.Response>.value(_FakeResponse())) returnValue: Future<_i2.Response>.value(_FakeResponse_0()))
as _i5.Future<_i2.Response>); as _i5.Future<_i2.Response>);
@override @override
_i5.Future<_i2.Response> delete(Uri? url, _i5.Future<_i2.Response> delete(Uri? url,
@ -80,7 +83,7 @@ class MockClient extends _i1.Mock implements _i4.Client {
(super.noSuchMethod( (super.noSuchMethod(
Invocation.method(#delete, [url], Invocation.method(#delete, [url],
{#headers: headers, #body: body, #encoding: encoding}), {#headers: headers, #body: body, #encoding: encoding}),
returnValue: Future<_i2.Response>.value(_FakeResponse())) returnValue: Future<_i2.Response>.value(_FakeResponse_0()))
as _i5.Future<_i2.Response>); as _i5.Future<_i2.Response>);
@override @override
_i5.Future<String> read(Uri? url, {Map<String, String>? headers}) => _i5.Future<String> read(Uri? url, {Map<String, String>? headers}) =>
@ -97,11 +100,9 @@ class MockClient extends _i1.Mock implements _i4.Client {
_i5.Future<_i3.StreamedResponse> send(_i8.BaseRequest? request) => _i5.Future<_i3.StreamedResponse> send(_i8.BaseRequest? request) =>
(super.noSuchMethod(Invocation.method(#send, [request]), (super.noSuchMethod(Invocation.method(#send, [request]),
returnValue: returnValue:
Future<_i3.StreamedResponse>.value(_FakeStreamedResponse())) Future<_i3.StreamedResponse>.value(_FakeStreamedResponse_1()))
as _i5.Future<_i3.StreamedResponse>); as _i5.Future<_i3.StreamedResponse>);
@override @override
void close() => super.noSuchMethod(Invocation.method(#close, []), void close() => super.noSuchMethod(Invocation.method(#close, []),
returnValueForMissingStub: null); returnValueForMissingStub: null);
@override
String toString() => super.toString();
} }

Loading…
Cancel
Save