nextcloud 1.0.9

  • Readme
  • Changelog
  • Example
  • Installing
  • 83

nextcloud #

A Nextcloud client for dart

Features #

  • Creating directories, removing directories and files
  • Uploading and downloading files
  • Directory listing
  • Get a user's full name and the groups the user belongs to
  • Move and copy files and folders
  • Create shares, update them and delete them. All share types supported (except federate cloud sharing)
  • Search for users to share a file or folder with (sharees)

Usage/Example #

https://github.com/jld3103/nextcloud/blob/master/example/example.dart

v1.0.9 #

  • Fix performance issues

v1.0.8 #

  • Add share type to sharees and webdav
  • Fix share permissions

v1.0.7 #

  • Add sharees search feature

v1.0.6 #

  • Add shares feature

v1.0.5 #

  • Fix web headers

v1.0.4 #

  • Fix upload body

v1.0.3 #

  • Add move and copy operations

v1.0.2 #

  • Change structure
  • Fix everything for web

v1.0.1 #

  • Fix download
  • Add content type

v1.0.0 #

  • Initial commit

example/example.dart

import 'dart:convert';

import 'package:nextcloud/nextcloud.dart';
import 'package:nextcloud/src/shares/share.dart';

Future main() async {
  try {
    final client = NextCloudClient('cloud.example.com', 'myuser', 'mypassword');
    await client.webDav.upload(utf8.encode('Test file'), '/test.txt');
    await listFiles(client);
    await client.webDav.move('/test.txt', '/abc.txt');
    await listFiles(client);
    await client.webDav.copy('/abc.txt', '/test.txt');
    await listFiles(client);

    final userData = await client.metaData.getMetaData();
    print(userData.fullName);
    print(userData.groups);

    // Sharing example
    print('Share file:');
    final share = await client.shares.shareWithUser('/test.txt', 'USER',
        permissions: Permissions([Permission.read, Permission.update]));
    print(share);
    print('List shared files');
    print((await client.shares.getShares(path: '/test.txt', reshares: false))
        .join('\n'));
    await client.shares.updateShareNote(share.id, 'Test notice');
    print('New note:');
    print(await client.shares.getShare(share.id));
    print('Delete share');
    await client.shares.deleteShare(share.id);
    print(
        'List shared files: ${(await client.shares.getShares(path: '/test.txt', reshares: false)).length}');

    await client.webDav.delete('/test.txt');
    await client.webDav.delete('/abc.txt');

    print('List all sharees:');
    print(await client.sharees.getSharees('', 1000, 'file'));
  } on RequestException catch (e, stacktrace) {
    print(e.cause);
    print(e.response);
    print(stacktrace);
  }
}

Future listFiles(NextCloudClient client) async {
  final files = await client.webDav.ls('/');
  for (final file in files) {
    print(file.path);
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  nextcloud: ^1.0.9

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:nextcloud/nextcloud.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
66
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
83
Learn more about scoring.

We analyzed this package on Jan 19, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.0
  • pana: 0.13.4

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.3.0 <3.0.0
dio ^3.0.7 3.0.8
intl ^0.16.0 0.16.1
xml ^3.6.1 3.7.0
Transitive dependencies
charcode 1.1.2
collection 1.14.12
convert 2.1.1
http_parser 3.1.3
meta 1.1.8
path 1.6.4
petitparser 3.0.0
source_span 1.6.0
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6