搜索插件、代码仓与 APP 分类

插件详情v3.0.0

multiline

提供便捷的多行字符串记录访问方法扩展。

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
299
喜欢数
26
Pub 分数
150

安装插件

flutter pub add multiline

插件介绍

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

多行字符串包通过为 Flutter 和 Dart 应用提供方法扩展,增强了其功能,使处理多行字符串更加便捷。它简化了多行文本数据的处理,让开发者能够轻松访问、操作和处理跨各种平台的字符串记录。凭借直观的语法和极少的样板代码,该包在处理模板、配置块或格式化输出等复杂文本内容时,显著提升了代码的可读性和可维护性。该包轻量且兼容所有主要的 Flutter 平台。

适合场景

  • 解析结构化文本块
  • 处理模板字符串
  • 处理配置数据
  • 格式化日志或调试输出
  • 在测试中使用代码片段

主要特点

  • 多行字符串的方法扩展
  • 用于逐行访问数据的简洁语法
  • 支持所有 Flutter 平台
  • 轻量且易于集成
  • 无外部依赖

适合对象

  • 开发文本密集型应用程序的开发者
  • 需要一致的多行字符串处理的团队
  • 涉及代码生成或模板的项目
  • 需要格式化字符串断言的测试环境

使用建议

  • 不适用于大规模文本处理
  • 仅限字符串操作,不支持完整解析
  • 最适合中小型多行内容

原始 README

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

multiline

Actions Status Coverage Pub Code size License: WTFPL effective_dart GitHub stars

About

Provides convenient access to multiline String records with method extensions.
Useful for templates, mockups and SQL queries.

Just use the symbol "|" to indicate the beginning of a line.
Beautiful code formatting using some useful extensions to the String methods.

Available method extensions:

  • multiline() - return formatted with pipeline symbol "|" String.

  • multilineSplit() - splits the string and returns a Iterable<String> of substrings.

You can use custom "pipeline" and "join" symbols.

For example

import 'package:multiline/multiline.dart'; // <= import package

void main() {
  /// Return formatted with pipeline symbol "`|`" [String].
  final string =
    '''
    |/*
    | * List of books and the number of
    | * authors associated with each book
    | */
    |SELECT
    |      `books`.`title` AS `Title`,
    |       count(*)       AS `Authors`
    |FROM  `books`
    |JOIN  `authors`
    |  ON  `books`.`isbn` = `authors`.`isbn`
    |GROUP BY
    |      `books`.`title`
    |ORDER BY
    |      `books`.`title` ASC
    |;
    '''.multiline();
  print(string);

  /// Splits the string and returns a [Iterable] of substrings.
  final iterable =
    '''
    | * One
    | * Two
    | * Three
    '''.multilineSplit();
  iterable.forEach(print);
}

Coverage

Changelog

Refer to the Changelog to get all release notes.

Maintainers

Plague Fox

License

WTFPL

所属分类

源码仓库

使用此插件的项目

暂无相关数据。