搜索分类、插件与代码仓

插件详情v0.10.0

basics

一个 Dart 库,包含对基本 Dart 对象的便捷扩展方法。

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
2.7万
喜欢数
113
Pub 分数
160

安装插件

flutter pub add basics

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

基础包是一个 Dart 库,为基本的 Dart 对象提供便捷的扩展方法,通过直观且可重用的功能增强其可用性。它简化了对 String、int 和 List 等核心类型进行的常见操作,促进代码更简洁、更具表现力。该库由 Google 设计,符合 Dart 最佳实践,并支持所有主要平台,包括 Android、iOS、Web、macOS、Windows 和 Linux。该库轻量级,非常适合希望提升代码可读性而又不增加复杂性的开发者。

适合场景

  • 简化字符串操作
  • 增强数值运算
  • 改进列表处理
  • 编写更易读的代码
  • 简化重复性任务

主要特点

  • 核心 Dart 类型的扩展方法
  • 轻量且高效
  • Platform-agnostic
  • Well-documented
  • 符合 Dart 约定

适合对象

  • Dart 初学者
  • 有经验的 Dart 开发人员
  • 跨平台应用开发
  • 代码质量改进
  • 极简实用工具库

使用建议

  • 仅限基本类型
  • 无运行时依赖
  • 不适用于复杂逻辑
  • 需要 Dart 2.12 或更高版本
  • 最好与其他工具配合使用

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

Dart CI pub package package publisher

This repository contains a collection of useful extension methods on the built-in objects in Dart, such as String, Iterable, and Object.

Usage

Import the basics library.

import 'package:basics/basics.dart';

Then use the methods directly on objects in your dart code.

import 'package:basics/basics.dart';

main() async {
  const numbers = <int>[2, 4, 8];

  if (numbers.all((n) => n.isEven)) {
    print('All numbers are even.');
  }

  print('sum of numbers is: ${numbers.sum()}');

  for (var _ in 5.range) {
    print('waiting 500 milliseconds...');
    await Future.delayed(500.milliseconds);
  }
}

Notes

This is not an official Google project.

所属分类

依赖

依赖清单 1 项

源码仓库

使用此插件的项目