Sr. Content Developer at Microsoft, working remotely in PA, TechBash conference organizer, former Microsoft MVP, Husband, Dad and Geek.
149530 stories
·
33 followers

Gaining Confidence with Az CLI and Az PowerShell: Introducing What if & Export Bicep

1 Share

Ever hesitated before hitting Enter on a command, wondering what changes it might make? You’re not alone. Whether you’re deploying resources or updating configurations, the fear of unintended consequences can slow you down. That’s why we’re introducing new powerful features in Azure CLI and Azure PowerShell to preview the changes the commands may make: the What if and Export Bicep features.

These capabilities allow you to preview the impact of your commands and allow you to export them as Bicep templates, all before making any changes to your Azure environment. Think of them as your safety net: you can validate actions, confirm resource changes, and even generate reusable infrastructure-as-code templates with confidence.

Currently, these features are in private preview, and we’re excited to share how you can get early access.

Why This Matters
  • Reduce risk: Avoid accidental resource deletions or costly misconfigurations.
  • Build confidence: Understand exactly what your command will do before execution.
  • Accelerate adoption of IaC: Convert CLI commands into Bicep templates automatically.
  • Improve productivity: Validate scripts quickly without trial-and-error deployments.

How It Works

What if preview of commands

All you have to do is add the `--what-if` parameter to Azure CLI commands and then the `-DryRun` command to Azure PowerShell commands like below.

Azure CLI:

az storage account create --name "mystorageaccount" --resource-group "myResourceGroup" --location "eastus" --what-if

Azure PowerShell:

New-AzVirtualNetwork -name MyVNET -ResourceGroupName MyResourceGroup -Location eastus -AddressPrefix "10.0.0.0/16" -DryRun
Exporting commands to Bicep

To generate bicep from the command you will have to add the `--export-bicep` command with the --what-if parameter to generate a bicep file. The bicep code will be saved under the `~/.azure/whatif` directory on your machine. The command will specific exactly where the file is saved on your machine.

Behind the scenes, AI translates your CLI command into Bicep code, creating a reusable template for future deployments. After generating the Bicep file, the CLI automatically runs a What-If analysis on the Bicep template to show you the expected changes before applying them.

Here is a video of it in action!

Here is another example where there is delete, modify and create actions happening all together.

Private Preview Access

These features are available in private preview. To sign up:

  1. Visit the aka.ms/PreviewSignupPSCLI
  2. Submit your request for access.
  3. Once approved, you’ll receive instructions to download the preview package.

Supported Commands (Private Preview)

Given these features are in a preview we have only added support for a small set of commands for the time being. Here’s a list of commands that will support these features during the private preview:

Azure CLI

  • Az vm create
  • Az vm update
  • az storage account create
  • az storage container create
  • az storage share create
  • az network vnet create
  • az network vnet update
  • az storage account network-rule add
  • az vm disk attach
  • az vm disk detach
  • az vm nic remove

Azure PowerShell

  • New-AzVM
  • Update-AzVM
  • New-AzStorageAccount
  • New-AzRmStorageShare
  • New-AzRmStorageContainer
  • New-AzVirtualNetwork
  • Set-AzVirtualNetwork
  • Add-AzStorageAccountNetworkRule

Next Steps

  • Sign up for the private preview.
  • Install the packages using the upcoming script.
  • Start using --what-if, -DryRun, and --export-bicep to make safer, smarter decisions and accelerate your IaC journey.
  • Give us feedback on what you think of the feature! At https://aka.ms/PreviewFeedbackWhatIf

Thanks so much!

 

Steven Bucher

PM for Azure Client Tools

 

Read the whole story
alvinashcraft
just a second ago
reply
Pennsylvania, USA
Share this story
Delete

AI and human potential: Advancing skills, innovation, and outcomes

1 Share

When empowered employees put AI skills into action, true transformation begins. Across industries and around the world, organizations are teaming up with Microsoft to help their employees learn the skills they need to put AI into practice.

Building AI skills today sets up employees and organizations to thrive in the opportunities of tomorrow. At visionary organizations, like Albertsons Companies, Casey’s, Levi Strauss, and Newell Brands, teams are moving beyond theory and weaving AI into everyday work, transforming routine tasks into opportunities for innovation and business growth.

This isn’t just about technology—it’s about people reimagining how they make an impact—and, in the process, they’re building resilience, driving growth, and creating success.

AI Skills Navigator: Guidance for your AI-powered growth

To help more people tap into this potential, we recently announced AI Skills Navigator an agentic learning space, bringing together AI-powered skilling experiences and credentials that help individuals build career skills and organizations worldwide accelerate their business.

Forward-thinking companies Icertis, LexisNexis Risk Solutions, MTN, and Vodafone previewed AI Skills Navigator and shared their excitement about the experience. They see this learning space as a way to strengthen their learning cultures, prepare their workforces for the future, and deliver meaningful results—from better customer experiences to innovation that scales.

Empowering teams to lead with confidence

We believe skilling should always start with people, especially in a fast-changing AI landscape. We’re inspired by what teams can achieve when they feel supported, and we’re proud to work with organizations of all sizes as they help their employees grow and lead with confidence. The examples that follow highlight how enterprises across industries and regions are building future-ready teams with Microsoft skilling—and seeing real impact.

  1. The Adecco Group, a leading talent solutions and advisory firm that serves more than 100,000 companies every year, is committed to upskilling its workforce and preparing employees for the future of work. Partnering with Microsoft, The Adecco Group provides skill-building that supports 300 million candidate interactions annually and fosters a learning culture that scales AI expertise across the company.
  2. Abu Dhabi National Oil Company (ADNOC), the state-owned energy company of Abu Dhabi, United Arab Emirates, operates across the entire oil and gas value chain. ADNOC and Microsoft have committed to co-develop and deploy agents that enhance efficiency, enable autonomous operations, and reduce emissions. This collaboration includes advanced AI tools and workforce training from Microsoft, in addition to the creation of a joint innovation ecosystem to drive transformative energy solutions.
  3. Albertsons Companies, one of the largest food and drug retailers in the United States, is helping its associates be more effective with AI. According to Anuj Dhanda, Executive Vice President (EVP), Chief Technology & Transformation Officer, "At Albertsons Companies, we’re better together, whether in our stores or behind the scenes, and we embrace groundbreaking innovation that empowers each of our team members to earn customers for life. Our partnership with Microsoft is one of many transformative AI initiatives we’re implementing to unlock the potential of AI, helping our associates to be more effective, simplify their work, and build a more capable workforce to serve our 37 million customers each week."
  4. The Belgian Ministry of Defense is working with Microsoft to strengthen its capabilities through the practical application of generative AI, supporting a future-ready workforce. With AI coaching, the ministry equips its personnel with the skills to enhance digital resilience and operational effectiveness.
  5. Bupa APAC, a global leader in health insurance, health services, and aged care, keeps skilling central to its strategy evolution. The company cites AI as a critical part of its transformation but points out that technology alone isn't enough. It’s focused on its teams—building the right skills to make AI effective across the organization.
  6. Casey’s, a Fortune 500 convenience store chain and one of the largest pizza retailers in the United States, is embracing AI throughout the company. As Sanjeev Satturu, Senior Vice President (SVP) and Chief Information Officer (CIO), explains, “At Casey's, we are dedicated to fostering digital dexterity by equipping our teams with innovative AI tools. Through our strategic partnership with Microsoft, we are providing employees with the knowledge and resources to seamlessly integrate AI into their daily work, empowering them to extend their capabilities, boost productivity, and drive our evolution. By embracing AI in everyday actions, we amplify our collective potential and accelerate meaningful progress across the organization.”
  7. Commonwealth Bank of Australia (CommBank), one of Australia’s largest banks, is guided by its goal to build a brighter future for all. With Microsoft skilling offerings, the bank is enabling its teams to engage with AI, use the latest tools, and embrace new ways of working, as employees find out how AI can drive real impact. With a structured skilling approach and real-world experimentation, CommBank employees are learning to confidently apply AI to their day-to-day tasks, stay ahead, innovate, and help shape the future of banking.
  8. Danone, a world leader in specialized nutrition, is exploring new frontiers in AI transformation. Juergen Esser, Deputy Chief Executive Officer (CEO) in charge of Finance, Technology and Data, observes, “Our collaboration with Microsoft will accelerate our AI transformation, providing us with the tools, technology, and expertise to explore new frontiers in data analysis, operational efficiency, and consumer engagement. Working together is not just about technology; it’s about fostering a culture of continuous learning, innovation, and performance across our organisation."
  9. EPAM, a global leader in digital engineering and AI-powered software engineering services, is differentiating itself by focusing on Microsoft Applied Skills, moving beyond academic knowledge to real client impact. This approach demonstrates proficiency, strengthens outcomes, and provides a clear competitive advantage. With Applied Skills, EPAM fast-tracks AI readiness and project outcomes.
  10. Icertis, a leader in AI-powered contract intelligence, previewed AI Skills Navigator. Shwetambari Salgar, Learning & Organisational Development, is enthusiastic, emphasizing, “AI Skills Navigator provides an opportunity to upskill Icertis teams for the future through a unified learning platform. As a long-time Microsoft partner, we have a shared drive for innovation and continuous learning.”
  11. Koç Holding is a Fortune Global 500 company and Turkey’s largest multinational conglomerate, operating across energy, automotive, finance, consumer goods, and retail sectors. The company is taking advantage of Microsoft Applied Skills, empowering more than 6,000 employees to build future-ready skills in cloud, AI, and automation—underscoring the company’s belief that digital transformation begins with people. Koç Holding employees demonstrate their technical expertise through real-world tasks with Applied Skills, which focus on targeted, scenario-based learning and validation. These staff members are turning their new skills into impact, solving business challenges and driving agility.
  12. Lenovo, a global technology powerhouse focused on delivering smarter technology for all, is expanding its collaboration with Microsoft to upskill an additional 4,200 employees this year, following the successful training of more than 3,000 to date. What began as a small pilot has evolved into one of Lenovo’s largest learning communities, reinforcing the company’s position as a leading force in the AI revolution.
  13. Levi Strauss & Co., global apparel company, is building the foundation to apply AI across its operations. As Karen Scholl, Vice President, Office of the Chief Digital & Technology Officer, explains, “We’re empowering our people to tap into the power of AI to unlock new possibilities, reimagine how we work, and accelerate our evolution into a best-in-class, direct-to-consumer retailer. Our partnership with Microsoft isn’t just about technology, but it’s about building the right foundation to embed AI across everything we do. From product design to store operations, we’re building and equipping every team member with the tools to drive innovation and growth, ensuring Levi’s continues to thrive for another 170 years. By leveraging Microsoft’s technological expertise, we’re redefining what’s possible for the future of retail.”
  14. LexisNexis Risk Solutions provides data analytics and technology to help organizations assess risk, ensure compliance, and prevent fraud. Sarah Fabius, Technology Optimization Program Manager, notes that the company is dedicated to equipping its workforce “with cutting-edge AI skills that fuel innovation in risk and data analytics technology. Through our partnership with Microsoft and the integration of AI Skills Navigator, we’re ensuring our teams have the tools and expertise to lead in a rapidly evolving industry.”
  15. MTN is Africa’s largest mobile network operator. Paul Norman, Group Chief Human Resources Officer, shares his perspective on AI Skills Navigator, noting, “At MTN, we believe in developing an AI-fluent organisation that empowers every employee to adopt and utilise AI responsibly and ethically. Microsoft AI Skills Navigator provides an exciting new learning innovation that can help demystify AI through its learner-centric and human-first approach to grow and develop an agile, resilient, and AI-inspired workforce of the future!"
  16. National Australia Bank (NAB), one of Australia’s largest financial institutions, is advancing its strategic commitment to AI, with more than 100 initiatives underway and thousands of employees already applying generative AI to deliver real business value. The bank emphasizes responsible AI, inclusive innovation, and strong leadership. Through a joint effort with Microsoft, 600 women have received AI training, reinforcing NAB’s vision of a diverse, future-ready workforce equipped to lead in the age of AI.
  17. Newell Brands, a leading consumer products company with a portfolio of iconic brands, is empowering its employees with Microsoft technology and skilling. As Chris Peterson, President and CEO, points out, “At Newell Brands, we see AI as a catalyst for creativity, productivity, and transformation. Through the Microsoft AI experience training series and access to Microsoft 365 Copilot, we’re empowering our employees with technology that helps them work smarter, boost productivity, and turn ideas into action faster. This is about more than adopting new technology—it’s about fueling innovation, driving efficiency, and creating lasting value across our business.”
  18. NTT DATA is a global IT services and consulting company that provides digital, cloud, and business solutions to help organizations innovate and transform. The company is building its workforce skills in generative AI in close collaboration with Microsoft and other leading partners. The company intends to train 200,000 of its employees by fiscal year 2027 and, as of October 2025, had already trained 70,000 of them. This initiative empowers staff members to apply generative AI independently, driving innovation in daily tasks and creating new value across the organization.
  19. OP Pohjola, Finland’s largest provider of financial services, is fueling transformation in the financial sector by embedding continuous learning into its culture. In a joint effort with Microsoft, the company is ensuring that every employee has the opportunity to build AI skills and can apply them responsibly every day. This commitment and world-class learning strengthens customer service, fosters innovation, and helps to shape the future of banking.
  20. Ricoh, a global technology company that provides digital services, printing solutions, and workplace innovation, believes that real transformation starts with people. The company is advancing AI adoption across its teams in the Asia-Pacific region, focusing on skill-building so team members can use new tools with confidence. Ricoh and Microsoft worked together to deliver AI Learning Week, which gave employees the opportunity to explore ways to apply AI meaningfully and responsibly and to reimagine how they work, enhancing human potential.
  21. Vodafone, a global telecommunications company, looks to the exciting possibilities of AI Skills Navigator. As Steve Garley, Senior Manager Technical and Digital Skills, explains, “AI Skills Navigator learner-first design aligns well with an AI-first approach and Vodafone’s ambition for readiness in the AI era. We see potential in Microsoft’s [skilling experience] to transform traditional training models and deliver role-based, just-in-time upskilling that drives real business outcomes.”

 

From retail to telecom and more, these organizations prove that empowered teams can spark innovation and lasting growth. Their experiences highlight a truth worth remembering—transformation starts with people. When employees feel confident in their skills, they create success that extends well beyond daily tasks. If you’re ready to empower your workforce with the full potential of AI skilling, get your teams started with AI Skills Navigator.

Read the whole story
alvinashcraft
16 seconds ago
reply
Pennsylvania, USA
Share this story
Delete

Fully Optimized: Wrapping up Performance Spotlight Week

1 Share
Posted by Ben Weiss, Senior Developer Relations Engineer and Sara Hamilton, Product Manager




We spent the past week diving deep into sharing best practices and guidance that helps to make Android apps faster, smaller, and more stable. From the foundational powers of the R8 optimizer and Profile Guided Optimizations, to performance improvements with Jetpack Compose, to a new guide on levelling up your app's performance, we've covered the low effort, high impact tools you need to build a performant app.

This post serves as your index and roadmap to revisit these resources whenever you need to optimize. Here are the five key takeaways from our journey together.

Use the R8 optimizer to speed up your app

The single most impactful, low-effort change you can make is fully enabling the R8 optimizer. It doesn't just reduce app size; it performs deep, whole-program optimizations to fundamentally rewrite your code for efficiency. Revisit your Keep Rules and get R8 back into your engineering tasks.


Our newly updated and expanded documentation on the R8 optimizer is here to help.


Reddit observed a 40% faster cold startup and 30% fewer ANR errors after enabling R8 full mode.

You can read the full case study on our blog.




Engineers at Disney+ invest in app performance and are optimizing the app's user experience. Sometimes even seemingly small changes can make a huge impact. While inspecting their R8 configuration, the team found that the -dontoptimize flag was being used. After enabling optimizations by removing this flag, the Disney+ team saw significant improvements in their app's performance.




So next time someone asks you what you could do to improve app performance, just link them to this post.


Read more in our Day 1 blog: Use R8 to shrink, optimize, and fast-track your app

Guiding you to better performance


Baseline Profiles effectively remove the need for Just in Time compilation, improving startup speed, scrolling, animation and overall rendering performance. Startup Profiles make app startup more even more lightweight by bringing an intelligent order to your app's classes.dex files.


And to learn more about just how important Baseline Profiles are for app performance, read Meta's engineering blog where they shared how Baseline Profiles improved various critical performance metrics by up to 40% across their apps.


We continue to make Jetpack Compose more performant for you in Jetpack Compose 1.10. Features like pausable composition and the customizable cache window are crucial for maintaining zero scroll jank when dealing with complex list items.Take a look at the latest episode of #TheAndroidShow where we explain this in more detail.


Read more in our Wednesday's blog: Deeper Performance Considerations

Measuring performance can be easy as 1, 2, 3


You can't manage what you don't measure. Our Performance Leveling Guide breaks down your measurement journey into five steps, starting with easily available data and building up to advanced local tooling.

Starting at level 1, we’ll teach you how to use readily available data from Android Vitals, which provides you with field data on ANRs, crashes, and excessive battery usage.


We’ll also teach you how to level up. For example, we’ll demonstrate how to reach level 3 with local performance testing using Jetpack Macrobenchmark and the new UiAutomator 2.4 API to accurately measure and verify any change in your app's performance.


Read more in our Thursday's blog

Debugging performance just got an upgrade


Advanced optimization shouldn't mean unreadable crash reports. New features are designed to help you confidently debug R8 and background work:

Automatic Logcat Retrace

Starting in Android Studio Narwhal, stack traces can automatically be de-obfuscated in the Logcat window. This way you can immediately see and debug any crashes in a production-ready build.

Narrow Keep Rules

On Tuesday we demystified the Keep Rules needed to fix runtime crashes, emphasizing writing specific, member-level rules over overly-broad wildcards. And because it's an important topic, we made you a video as well.

And with the new lint check for wide Keep Rules, the Android Studio Otter 3 Feature Drop has you covered here as well.

We also released new guidance on testing and troubleshooting your R8 configuration to help you get the configuration right with confidence.



Read more in our Tuesday's blog: Configure and troubleshoot R8 Keep Rules

Background Work

We shared guidance on debugging common scenarios you may encounter when scheduling tasks with WorkManager.

Background Task Inspector gives you a visual representation and graph view of WorkManager tasks, helping debug why scheduled work is delayed or failed. And our refreshed Background Work documentation landing page highlights task-specific APIs that are optimized for particular use cases, helping you achieve more reliable execution.


Read more in our Wednesday's blog: Background work performance considerations

Performance optimization is an ongoing journey

If you successfully took our challenge to enable R8 full mode this week, your next step is to integrate performance into your product roadmap using the App Performance Score. This standardized framework helps you find the highest leverage action items for continuous improvement.

We capped off the week with the #AskAndroid Live Q&A session, where engineers answered your toughest questions on R8, Profile Guided Optimizations, and more. If you missed it, look for the replay!


Thank you for joining us! Now, get building and keep that momentum going.




Read the whole story
alvinashcraft
48 seconds ago
reply
Pennsylvania, USA
Share this story
Delete

Antigravity and Firebase MCP accelerate app development

1 Share
Read the whole story
alvinashcraft
58 seconds ago
reply
Pennsylvania, USA
Share this story
Delete

What’s new in DCM 1.33.0

1 Share

Cover

With a little delay, we are excited to announce the release of DCM 1.33.0!

This release includes 8 new rules (5 for Dot shorthands), Dot shorthands support for all existing rules and features, improved detection of unused code in various new cases (unassigned fields, setters, code that is used only in generated files and so on), automatic Dashboards project creation based on the monorepo structure, redesigned Dashboards page with support for tagging projects, and more!

Let’s go through the highlights of this release (and the full list of changes is in our changelog)!

Dashboard Improvements

New Project View and Tags

To help you group projects by your own rules, Dashboards now support custom tags in the Project List:

Add Tag

You can also select a tag (or several tags) on the Projects Overview tab and get a summary for a particular tag (or several tags):

Issues Overview

External Users

Inviting users to the DCM Teams Console now also supports external users (users with an email address that doesn't match the account's domain name).

Add External User Modal

Such users also have a dedicated label:

External User

Note, that external users can only have the "View Selected" role. Please carefully check the external user's email before granting them access to your projects.

Automatic Projects Creation

info

This feature is available to Enterprise users only.

You can now automatically create Dashboards projects from your monorepo structure with the help of the new --scaffold flag.

Here are the required steps:

  1. Add a new project entry to the dcm config in every package's analysis_options.yaml file (this entry can be any string and will be used both as the unique project id and its name, which you can change later):

    analysis_options.yaml
    dcm:
    project: my_monorepo_package
  2. Add the --scaffold flag to your uploads (and use the Global Project Key for the --project option).

  3. Keep the --scaffold flag in every run (not just the first one).

When using --scaffold, the tool will compare unique project ids and create missing projects. Then, it will assign uploaded data to each corresponding project.

If the unique id changes, it will only create a new project and never delete any existing ones.

Unused Code Detection Improvements

Unassigned Fields

Now, if a public or private field is referenced, but never assigned, the tool will report such fields as unused code.

For example,

class AssignmentsExample {
String? inner;

void dispose() {
print(inner);
final value = inner?.split(',');
}
}

here, even though the field is referenced (print(inner) and inner?.split(',')), it actually never receives a value making the field itself unused and all the code that references this field to always result in null.

Collection Methods and Properties

Another improvement to the unused code detection covers collection methods and statements with properties.

For example,

class WithCollection {
final directMap = <String, String>{};

WithCollection();

void notUsage() {
directMap['hello'] = 'hi';
directMap.length;
}
}

here, even though, both directMap['hello'] = 'hi' and directMap.length reference the directMap field, both of them do not indicate the usage of that field.

With this release, such cases will be reported as unused code.

Asserts

With this release, any code that is used only in asserts is now reported as unused.

For example,

class Some {
final String? value
final int another;

const Some(this.value, this.another): assert(another > 0);

void work() {
print(value);
}
}

here, the only place the another field is used is the assert initializer.

Setters

Prior to this release, setters were excluded by default even if they were never used to support cases when developers always create a pair of a getter and setter.

With this release we are removing this exception making the command always report unused setters.

If you still wish to keep unused setters in your codebase, consider adding ignore comments (e.g. // ignore: unused-code).

Generated Code (moved to 1.34)

note

This feature was initially added in 1.33 and removed in 1.33.1 as it had a lot of false positives. We plan to bring it back in 1.34.

In some cases, for example, when you declare models for your app and then generate copyWith and other methods via code generation, such classes can still be referenced in the generated files, but not by any of your code.

With this change we aim to highlight such classes in the generated files so you can quickly identify and remove them.

IDE Integration

With this release we are removing the IDE integration for unused code and files detection.

The integration had several issues (including memory leaks, not analyzing excluded files properly, not supporting all issues reported by the check-unused-code command and so on).

We plan to reintroduce this feature later in 2026 while also addressing all the known issues.

Rule Updates

Dot Shorthands

All lint rules (and other features) now support latest language changes (including Dot shorthands).

Notable Changes

avoid-unused-local-variable

Now supports the same checks as the check-unused-code command when it comes to collection methods and properties:

void fn() {
final List<String> items = {}; // LINT

items.add('');
items.addAll(['']);
items.clear();
items.remove('');
items.removeWhere((element) => false);
items.retainWhere((element) => false);

final str = '123'; // LINT
str.length;
}

here, even though the items list is mutated, it is never passed to any other function therefore making the variable actually unused. Same for str.

avoid-unassigned-late-fields

Now only highlights private late fields (or late fields for private declarations):

class Test {
late int anotherField;

late int uninitializedField;

late int _privateLate; // LINT

void method() {
anotherField = 1;
}
}

New Rules

note

All new rules for Dot shorthands are also available to the Starter plan users.

prefer-returning-shorthands

Suggests returning dot shorthands from an expression function body.

Function and methods declarations already have an explicit return type and in cases when that type is the same as the returned instance, the instance can be simplified to a dot shorthand without reducing readability.

// LINT: This instance type matches the return type and can be replaced with a dot shorthand.
// Try using the dot shorthand constructor.
SomeClass getInstance() => SomeClass('val');

// LINT: This instance type matches the return type and can be replaced with a dot shorthand.
// Try using the dot shorthand constructor.
SomeClass getInstance() => SomeClass.named('val');

// LINT: This instance type matches the return type and can be replaced with a dot shorthand.
// Try using the dot shorthand constructor.
SomeClass getInstance(bool flag) =>
flag ? SomeClass('value') : SomeClass.named('val');

class SomeClass {
final String value;

const SomeClass(this.value);

const SomeClass.named(this.value);
}

To fix these issues, use dot shorthands in all highlighted places:

SomeClass getInstance() => .new('val');

SomeClass getInstance() => .named('val');

SomeClass getInstance(bool flag) =>
flag ? .new('value') : .named('val');

This rule also comes with auto-fix.

prefer-shorthands-with-static-fields

Suggests using dot shorthands with static fields.

When a static field type matches the type of its class, such fields can be used as dot shorthands (without an explicit class prefix).

void fn(SomeClass? e) {
switch (e) {
// LINT: Prefer dot shorthands instead of explicit class prefixes. Try removing the prefix.
case SomeClass.first:
print(e);
}

final v = switch (e) {
// LINT: Prefer dot shorthands instead of explicit class prefixes. Try removing the prefix.
SomeClass.first => 1,
_ => 2,
};

// LINT: Prefer dot shorthands instead of explicit class prefixes. Try removing the prefix.
final SomeClass another = SomeClass.first;

// LINT: Prefer dot shorthands instead of explicit class prefixes. Try removing the prefix.
if (e == SomeClass.first) {}
}

// LINT: Prefer dot shorthands instead of explicit class prefixes. Try removing the prefix.
void another({SomeClass value = SomeClass.first}) {}

// LINT: Prefer dot shorthands instead of explicit class prefixes. Try removing the prefix.
SomeClass getClass() => SomeClass.first;

class SomeClass {
final String value;

const SomeClass(this.value);

static const first = SomeClass('first');
static const second = SomeClass('second');
}

To fix these issues, remove the class name prefix:

void fn(SomeClass? e) {
switch (e) {
case .first:
print(e);
}

final v = switch (e) {
.first => 1,
_ => 2,
};

final SomeClass another = .first;

if (e == .first) {}
}

void another({SomeClass value = .first}) {}

SomeClass getClass() => .first;

Object getObject() => SomeClass.first;

This rule also comes with auto-fix.

prefer-shorthands-with-enums

Suggests using dot shorthands with enums.

void fn(MyEnum? e) {
switch (e) {
// LINT: Prefer dot shorthands instead of explicit enum prefixes. Try removing the enum prefix.
case MyEnum.first:
print(e);
}

final v = switch (e) {
// LINT: Prefer dot shorthands instead of explicit enum prefixes. Try removing the enum prefix.
MyEnum.first => 1,
_ => 2,
};

// LINT: Prefer dot shorthands instead of explicit enum prefixes. Try removing the enum prefix.
final MyEnum another = MyEnum.first;

// LINT: Prefer dot shorthands instead of explicit enum prefixes. Try removing the enum prefix.
if (e == MyEnum.first) {}
}

// LINT: Prefer dot shorthands instead of explicit enum prefixes. Try removing the enum prefix.
void another({MyEnum value = MyEnum.first}) {}

// LINT: Prefer dot shorthands instead of explicit enum prefixes. Try removing the enum prefix.
MyEnum getEnum() => MyEnum.first;

enum MyEnum { first, second }

To fix these issues, remove the enum prefix:

void fn(MyEnum? e) {
switch (e) {
case .first:
print(e);
}

final v = switch (e) {
.first => 1,
_ => 2,
};

final MyEnum another = .first;

if (e == .first) {}
}

void another({MyEnum value = .first}) {}

MyEnum getEnum() => .first;

Object getObject() => MyEnum.first;

This rule also comes with auto-fix.

avoid-nested-shorthands

Warns when a dot shorthand invocation has an argument that is also a dot shorthand.

Nested dot shorthands significantly reduce readability (to a point where every instance is .new(.new(...))) and should be generally avoided.

void fn() {
// LINT: Avoid nested dot shorthands as they significantly reduce readability. Try adding explicit types.
final Another a = .new(.new(version: .new('val')));

// LINT: Avoid nested dot shorthands as they significantly reduce readability. Try adding explicit types.
final a = Another(.new(version: .new('val')));
}

class SomeClass {
final String value;

const SomeClass(this.value);
}

class Some {
final SomeClass version;

const Some({required this.version});
}

class Another {
final Some some;

Another(this.some);
}

prefer-shorthands-with-constructors

Suggests using dot shorthand constructor invocations for the configured list of classes.

Padding(
// LINT: Prefer dot shorthands instead of explicit class instantiations.
// Try using the dot shorthand constructor.
padding: EdgeInsets.symmetric(
horizontal: horizontalPadding(screenWidth),
vertical: 12,
),
);

BoxDecoration(
color: Colors.transparent,
// LINT: Prefer dot shorthands instead of explicit class instantiations.
// Try using the dot shorthand constructor.
border: Border.all(
color: AppColors.primary.withOpacity(_controller.value),
width: 2,
),
// LINT: Prefer dot shorthands instead of explicit class instantiations.
// Try using the dot shorthand constructor.
borderRadius: BorderRadius.circular(18),
);

Additionally, this rule supports a config option called entries to configure a list of constructors that should be converted to dot shorthands.

For example,

analysis_options.yaml
dcm:
rules:
- prefer-shorthands-with-constructors:
entries:
- EdgeInsets
- BorderRadius
- Radius
- Border
- MyClass

This rule also comes with auto-fix.

newline-before-constructor

Enforces a blank line before a constructor declaration.

For example,

class Wrong {
Wrong();
Wrong.first(); // LINT: Missing a blank line before this constructor declaration. Try adding it.
Wrong.second(); // LINT: Missing a blank line before this constructor declaration. Try adding it.
}

is expected to be

class Wrong {
Wrong();

Wrong.first();

Wrong.second();
}

This rule also comes with auto-fix.

avoid-always-null-parameters

Warns when a private function or method has a parameter that always gets null. Such parameters can be removed.

class Some {
void work() {
_fn(null);
}

// LINT: This parameter always gets a null value. Try removing it.
void _fn(String? nullable) {
if (nullable == null) {
// handle nullable case
} else {
// handle regular case
}
}
}

avoid-unassigned-fields

Warns when a private field is not assigned a value.

For example,

class Test {
final _field = 'string';

// LINT: This field is never assigned a value within its declaration.
// Try assigning a value or removing this field.
int? _privateLate;
}

here, _privateLate never gets a value and should be either removed or assigned a value.

What’s next

To learn more about upcoming features, keep an eye on our public roadmap.

And to learn more about our upcoming videos and "Rules of the Week" content, subscribe to our Youtube Channel.

Sharing your feedback

If there is something you miss from DCM right now, want us to make something better, or have any general feedback — join our Discord server! We’d love to hear from you.

Read the whole story
alvinashcraft
1 minute ago
reply
Pennsylvania, USA
Share this story
Delete

25 Things Nano Banana Pro Does That AI Couldn't Before

1 Share
From: AIDailyBrief
Duration: 16:41
Views: 7,562

Today’s AI Daily Brief breaks down the stunning leap unlocked by Google’s Nano Banana Pro image model, which isn’t just an upgrade but a wholesale expansion of what’s possible with AI image generation. From real text rendering to accurate charts, whiteboard-style compression of dense documents, educational visuals, flowcharts, technical drawings, virtual staging, precise spot-editing, and media-to-media transformations, this episode covers 25 capabilities that genuinely didn’t exist in the previous state of the art and explains why this model’s reasoning-on-images paradigm represents one of the biggest practical unlocks in years.

The AI Daily Brief helps you understand the most important news and discussions in AI.
Subscribe to the podcast version of The AI Daily Brief wherever you listen: https://pod.link/1680633614
Get it ad free at
Join our Discord: https://bit.ly/aibreakdown

Read the whole story
alvinashcraft
1 minute ago
reply
Pennsylvania, USA
Share this story
Delete
Next Page of Stories