dart fix --apply --code=unnecessary_this

This commit is contained in:
Caleb Jasik 2025-02-13 11:15:40 -06:00
parent d3f560d9b7
commit 45f3af5646
No known key found for this signature in database
9 changed files with 37 additions and 37 deletions

View file

@ -48,7 +48,7 @@ class IPField extends StatelessWidget {
maxLength: ipOnly ? 15 : null, maxLength: ipOnly ? 15 : null,
maxLengthEnforcement: ipOnly ? MaxLengthEnforcement.enforced : MaxLengthEnforcement.none, maxLengthEnforcement: ipOnly ? MaxLengthEnforcement.enforced : MaxLengthEnforcement.none,
inputFormatters: ipOnly ? [IPTextInputFormatter()] : [FilteringTextInputFormatter.allow(RegExp(r'[^\s]+'))], inputFormatters: ipOnly ? [IPTextInputFormatter()] : [FilteringTextInputFormatter.allow(RegExp(r'[^\s]+'))],
textInputAction: this.textInputAction, textInputAction: textInputAction,
placeholder: help, placeholder: help,
), ),
); );

View file

@ -43,7 +43,7 @@ class SimplePage extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
Widget realChild = child; Widget realChild = child;
var addScrollbar = this.scrollbar; var addScrollbar = scrollbar;
if (scrollable == SimpleScrollable.vertical || scrollable == SimpleScrollable.both) { if (scrollable == SimpleScrollable.vertical || scrollable == SimpleScrollable.both) {
realChild = SingleChildScrollView( realChild = SingleChildScrollView(
@ -83,7 +83,7 @@ class SimplePage extends StatelessWidget {
} }
if (alignment != null) { if (alignment != null) {
realChild = Align(alignment: this.alignment!, child: realChild); realChild = Align(alignment: alignment!, child: realChild);
} }
if (bottomBar != null) { if (bottomBar != null) {

View file

@ -44,7 +44,7 @@ class ConfigPageItem extends StatelessWidget {
Widget _buildContent(BuildContext context) { Widget _buildContent(BuildContext context) {
return SpecialButton( return SpecialButton(
onPressed: this.disabled ? null : onPressed, onPressed: disabled ? null : onPressed,
color: Utils.configItemBackground(context), color: Utils.configItemBackground(context),
child: Container( child: Container(
padding: EdgeInsets.symmetric(vertical: 6, horizontal: 15), padding: EdgeInsets.symmetric(vertical: 6, horizontal: 15),
@ -54,7 +54,7 @@ class ConfigPageItem extends StatelessWidget {
children: <Widget>[ children: <Widget>[
label != null ? Container(width: labelWidth, child: label) : Container(), label != null ? Container(width: labelWidth, child: label) : Container(),
Expanded(child: Container(child: content, padding: EdgeInsets.only(right: 10))), Expanded(child: Container(child: content, padding: EdgeInsets.only(right: 10))),
this.disabled disabled
? Container() ? Container()
: Icon(CupertinoIcons.forward, color: CupertinoColors.placeholderText.resolveFrom(context), size: 18), : Icon(CupertinoIcons.forward, color: CupertinoColors.placeholderText.resolveFrom(context), size: 18),
], ],

View file

@ -107,7 +107,7 @@ class _AppState extends State<App> {
cupertino: (_, __) => CupertinoAppData(theme: CupertinoThemeData(brightness: brightness)), cupertino: (_, __) => CupertinoAppData(theme: CupertinoThemeData(brightness: brightness)),
onGenerateRoute: (settings) { onGenerateRoute: (settings) {
if (settings.name == '/') { if (settings.name == '/') {
return platformPageRoute(context: context, builder: (context) => MainScreen(this.dnEnrolled)); return platformPageRoute(context: context, builder: (context) => MainScreen(dnEnrolled));
} }
final uri = Uri.parse(settings.name!); final uri = Uri.parse(settings.name!);
@ -117,7 +117,7 @@ class _AppState extends State<App> {
context: context, context: context,
builder: builder:
(context) => (context) =>
EnrollmentScreen(code: EnrollmentScreen.parseCode(settings.name!), stream: this.dnEnrolled), EnrollmentScreen(code: EnrollmentScreen.parseCode(settings.name!), stream: dnEnrolled),
); );
} }

View file

@ -4,8 +4,8 @@ class CertificateInfo {
CertificateValidity? validity; CertificateValidity? validity;
CertificateInfo.debug({this.rawCert = ""}) CertificateInfo.debug({this.rawCert = ""})
: this.cert = Certificate.debug(), : cert = Certificate.debug(),
this.validity = CertificateValidity.debug(); validity = CertificateValidity.debug();
CertificateInfo.fromJson(Map<String, dynamic> json) CertificateInfo.fromJson(Map<String, dynamic> json)
: cert = Certificate.fromJson(json['Cert']), : cert = Certificate.fromJson(json['Cert']),
@ -24,7 +24,7 @@ class Certificate {
String fingerprint; String fingerprint;
String signature; String signature;
Certificate.debug() : this.details = CertificateDetails.debug(), this.fingerprint = "DEBUG", this.signature = "DEBUG"; Certificate.debug() : details = CertificateDetails.debug(), fingerprint = "DEBUG", signature = "DEBUG";
Certificate.fromJson(Map<String, dynamic> json) Certificate.fromJson(Map<String, dynamic> json)
: details = CertificateDetails.fromJson(json['details']), : details = CertificateDetails.fromJson(json['details']),
@ -44,7 +44,7 @@ class CertificateDetails {
String issuer; String issuer;
CertificateDetails.debug() CertificateDetails.debug()
: this.name = "DEBUG", : name = "DEBUG",
notBefore = DateTime.now(), notBefore = DateTime.now(),
notAfter = DateTime.now(), notAfter = DateTime.now(),
publicKey = "", publicKey = "",
@ -70,7 +70,7 @@ class CertificateValidity {
bool valid; bool valid;
String reason; String reason;
CertificateValidity.debug() : this.valid = true, this.reason = ""; CertificateValidity.debug() : valid = true, reason = "";
CertificateValidity.fromJson(Map<String, dynamic> json) : valid = json['Valid'], reason = json['Reason']; CertificateValidity.fromJson(Map<String, dynamic> json) : valid = json['Valid'], reason = json['Reason'];
} }

View file

@ -139,25 +139,25 @@ class Site {
_updateFromJson(String json) { _updateFromJson(String json) {
var decoded = Site._fromJson(jsonDecode(json)); var decoded = Site._fromJson(jsonDecode(json));
this.name = decoded["name"]; name = decoded["name"];
this.id = decoded['id']; // TODO update EventChannel id = decoded['id']; // TODO update EventChannel
this.staticHostmap = decoded['staticHostmap']; staticHostmap = decoded['staticHostmap'];
this.ca = decoded['ca']; ca = decoded['ca'];
this.certInfo = decoded['certInfo']; certInfo = decoded['certInfo'];
this.lhDuration = decoded['lhDuration']; lhDuration = decoded['lhDuration'];
this.port = decoded['port']; port = decoded['port'];
this.cipher = decoded['cipher']; cipher = decoded['cipher'];
this.sortKey = decoded['sortKey']; sortKey = decoded['sortKey'];
this.mtu = decoded['mtu']; mtu = decoded['mtu'];
this.connected = decoded['connected']; connected = decoded['connected'];
this.status = decoded['status']; status = decoded['status'];
this.logFile = decoded['logFile']; logFile = decoded['logFile'];
this.logVerbosity = decoded['logVerbosity']; logVerbosity = decoded['logVerbosity'];
this.errors = decoded['errors']; errors = decoded['errors'];
this.unsafeRoutes = decoded['unsafeRoutes']; unsafeRoutes = decoded['unsafeRoutes'];
this.managed = decoded['managed']; managed = decoded['managed'];
this.rawConfig = decoded['rawConfig']; rawConfig = decoded['rawConfig'];
this.lastManagedUpdate = decoded['lastManagedUpdate']; lastManagedUpdate = decoded['lastManagedUpdate'];
} }
static _fromJson(Map<String, dynamic> json) { static _fromJson(Map<String, dynamic> json) {
@ -331,7 +331,7 @@ class Site {
Future<Map<String, List<HostInfo>>> listAllHostmaps() async { Future<Map<String, List<HostInfo>>> listAllHostmaps() async {
try { try {
var res = await Future.wait([this.listHostmap(), this.listPendingHostmap()]); var res = await Future.wait([listHostmap(), listPendingHostmap()]);
return {"active": res[0], "pending": res[1]}; return {"active": res[0], "pending": res[1]};
} on PlatformException catch (err) { } on PlatformException catch (err) {
throw err.details ?? err.message ?? err.toString(); throw err.details ?? err.message ?? err.toString();

View file

@ -103,7 +103,7 @@ class _EnrollmentScreenState extends State<EnrollmentScreen> {
padding: EdgeInsets.only(top: 20), padding: EdgeInsets.only(top: 20),
); );
} }
} else if (this.error != null) { } else if (error != null) {
// Error while enrolling, display it // Error while enrolling, display it
child = Center( child = Center(
child: Column( child: Column(
@ -137,7 +137,7 @@ class _EnrollmentScreenState extends State<EnrollmentScreen> {
padding: EdgeInsets.symmetric(horizontal: 16, vertical: 10), padding: EdgeInsets.symmetric(horizontal: 16, vertical: 10),
), ),
Container( Container(
child: Padding(child: SelectableText(this.error!), padding: EdgeInsets.all(16)), child: Padding(child: SelectableText(error!), padding: EdgeInsets.all(16)),
color: Theme.of(context).colorScheme.errorContainer, color: Theme.of(context).colorScheme.errorContainer,
), ),
], ],
@ -145,7 +145,7 @@ class _EnrollmentScreenState extends State<EnrollmentScreen> {
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
), ),
); );
} else if (this.enrolled) { } else if (enrolled) {
// Enrollment complete! // Enrollment complete!
child = Padding( child = Padding(
child: Center(child: Text('Enrollment complete! 🎉', textAlign: TextAlign.center)), child: Center(child: Text('Enrollment complete! 🎉', textAlign: TextAlign.center)),

View file

@ -27,7 +27,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
void initState() { void initState() {
//TODO: we need to unregister on dispose? //TODO: we need to unregister on dispose?
settings.onChange().listen((_) { settings.onChange().listen((_) {
if (this.mounted) { if (mounted) {
setState(() {}); setState(() {});
} }
}); });

View file

@ -27,7 +27,7 @@ class StaticHostmapScreen extends StatefulWidget {
this.lighthouse = false, this.lighthouse = false,
this.onDelete, this.onDelete,
required this.onSave, required this.onSave,
}) : this.destinations = destinations ?? []; }) : destinations = destinations ?? [];
final List<IPAndPort> destinations; final List<IPAndPort> destinations;
final String nebulaIp; final String nebulaIp;