Flutter插件nohfibu的使用方法
Flutter插件nohfibu的使用方法
在本文中,我们将探索如何在Flutter应用中使用一个名为nohfibu
的未知功能插件。该插件主要用于财务会计,并且基于复式记账法(由Luca Paciolo首次提出)。
入门指南
首先,我们需要安装nohfibu
插件。你可以通过多种方式安装它,例如使用pubspec.yaml
文件或直接从源码中运行。
使用 pubspec.yaml
安装
如果你使用的是pubspec.yaml
文件,可以添加以下依赖:
dependencies:
nohfibu:
然后运行flutter pub get
来获取新的依赖项。
直接从源码中运行
你也可以直接从源码中运行nohfibu
插件。这需要克隆仓库并运行脚本。
使用 nohfibu
插件
一旦安装了nohfibu
插件,我们就可以开始使用它来执行一些基本操作,例如数据转换和会计分析。
数据转换
nohfibu
提供了一个转换器,用于将旧数据转换为CSV格式,以便导入到新的 Dart fibu
中。
dart run bin/wbconvert.dart --help
示例输出:
### bboett@videopi:fibu$ dart run bin/wbconvert.dart --help
### bin/wbconvert.dart: Warning: Interpreting this as package URI, 'package:nohfibu/wbconvert.dart'.
### applying args: lang:de base:null out:null help:true strict:false rest: []
### -l, --lang Language setting
### (defaults to "de")
### -f, --file Basename of the dataset
### -o, --output output name
### -?, --[no-]help Help about the options
### -s, --[no-]strict enforce old WB-Style parsing
要实际进行转换,可以使用以下命令:
dart run bin/wbconvert.dart -f <your kpl file> -s
这将生成一个CSV文件,可以进一步处理。
会计分析
nohfibu
还提供了对CSV文件进行会计分析的功能。例如:
$ dart run bin/nohfibu.dart --help # to test directly from the source dir
$ nohfibu --help # if you have activated the project, or precompiled
$ nohfibu -r -b assets/wbsamples/sample # will analyze the .csv file and produce a .lst result file
$ nohfibu -b assets/wbsamples/sample -f MERCH # will try to fill in new journal lines following the MERCH receipe (in the .csv file under OPS)
示例代码
下面是一个完整的示例代码,展示了如何在Flutter应用中使用nohfibu
插件。
import 'dart:io';
import 'package:nohfibu/fibusettings.dart';
import 'package:nohfibu/csv_handler.dart';
import 'package:nohfibu/nohfibu.dart';
/// Launcher for the accounting analysis
///
/// -r launches the analysis
/// -b <name> set the base name to work on
///
/// Issues a result file with the accounting analysis
class Fibu {
bool strict = false;
///book holds the accounting plan and the journal
Book book = Book();
///CTOR
Fibu({this.strict = false});
/// launch the financial analysis, meaning, making the account extracts, fill in the final state
/// of the accounts, and compare the 4 blocks of account (aktiva/passiva, expenses/income)
/// to validate the accounting period
String execute() {
print("asked to run!");
book.execute(); //TODO we should report if there were errors....
String result = book.toString() + "\n";
result += book.kpl.toString(extracts: true);
result += "=" * 20 + " Analysis " + "=" * 20 + "\n";
//result += "Aktiva \n"+ (book.kpl.get("1")).toString(recursive: true)+"\n";
result += book.kpl.analysis();
return result;
}
}
///to have a command line version of this program
void main(List<String> arguments) //async
{
//print("incoming : $arguments");
///add command line argument parsing
FibuSettings settings = FibuSettings();
settings.parser.addFlag('run',
abbr: 'r', defaultsTo: false, help: "run the accounting process");
settings.init(arguments);
Fibu fibu = Fibu();
//print("result of arg run... : ${argResults["help"]}\n");
//print("result of arg run... : ${argResults["help"]} sh: ${argResults["\?"]}\n");
if (settings["help"] || settings["error"]) {
print(settings.usage);
exit(0);
}
///provided a basename was given, a file with the data can be loaded , the CsvHandler class, reads in the csv
/// and fills the book
if (settings["base"] != null && settings["base"].isNotEmpty) {
//print("opening file ${settings["base"]}");
String basename = settings["base"];
String fname = basename + ".csv";
var handler = CsvHandler();
handler.load(book: fibu.book, conf: settings);
if (settings["run"]) {
String result = fibu.execute();
fname = (settings["output"].isNotEmpty)
? settings["output"]
: basename + ".lst";
//print ("retrieved\n$result");
File(fname).writeAsString(result).then((file) {
print("write seems successful, please check $fname");
});
} else
print(
"book so far: ${fibu.book} you need to set run if you want a compilation");
} else
print("no file to load");
print("end of processing");
}
更多关于Flutter插件nohfibu的使用方法的实战教程也可以访问 https://www.itying.com/category-92-b0.html
更多关于Flutter插件nohfibu的使用方法的实战系列教程也可以访问 https://www.itying.com/category-92-b0.html
在Flutter开发中,插件(Plugins)是用于扩展Flutter应用功能的重要工具。它们通常提供了与平台特定功能(如相机、地理位置、传感器等)的接口。然而,关于你提到的“nohfibu”插件,目前并没有公开的、广泛认可的信息或文档。这可能是由于以下原因:
-
拼写错误:你可能在拼写插件名称时出现了错误。请检查插件的名称是否正确。
-
私有插件:这个插件可能是某个公司或开发者内部使用的私有插件,没有公开发布。
-
新插件或实验性插件:如果这个插件是最近开发的,可能还没有足够的文档或社区支持。
-
不存在的插件:也有可能这个插件并不存在,或者你误解了某个插件的名称。
探索和使用的步骤
如果你确信这个插件存在,并且想要探索和使用它,可以按照以下步骤进行:
-
搜索插件:
- 在pub.dev上搜索“nohfibu”,看看是否有相关的插件发布。
- 在GitHub或其他代码托管平台上搜索这个插件。
-
查看文档:
- 如果找到了插件,查看其官方文档,了解如何安装和配置。
- 通常,插件的文档会提供详细的安装步骤、API使用方法和示例代码。
-
安装插件:
- 在
pubspec.yaml
文件中添加插件的依赖项。例如:dependencies: nohfibu: ^1.0.0
- 运行
flutter pub get
命令来安装插件。
- 在
-
使用插件:
- 根据插件的文档,在代码中导入并使用插件提供的功能。例如:
import 'package:nohfibu/nohfibu.dart';
- 根据插件的文档,在代码中导入并使用插件提供的功能。例如: